Pasta-maker Barilla is receiving high marks from a gay rights group. (Julia Ewan/The Washington Post)

Not long ago, pasta-maker Barilla was just one more major company that had run afoul of the gay rights movement, a distinction it earned last year when its chairman said he would never feature a same-sex couple in an ad. If gays didn’t like it, he added, they could eat something else.

But in a sign of how toxic it has become for a company to be viewed as unfriendly toward gays, Barilla has made a dramatic turnaround in the space of one year, expanding health benefits for transgender workers and their families, contributing money to gay rights causes, and featuring a lesbian couple on a promotional Web site.

Barilla has journeyed from gay rights pariah to poster child — on Wednesday it received a perfect score from a prominent gay rights group that rates companies on their gay-friendliness. It is an about-face that highlights how companies, which typically shy away from controversy, are increasingly being forced to take sides in the cultural battle over gay rights and same-sex marriage — and how decisively pro-gay forces have gained the upper hand.

Other household-name brands have also found themselves in hot water over actions that were perceived to be anti-gay. Target, for example, strived to make amends after coming under fire in 2010 for political contributions that supported a Minnesota gubernatorial candidate who opposed same-sex marriage. Chick-fil-A stopped giving to certain organizations in 2012 after earning the ire of gay rights groups that accused the fast-food chain of supporting anti-gay causes.

Both companies were subject to boycotts, though there has been a counter effort by socially conservative groups to support and embrace Chick-fil-A.

The peril for companies is not short-term profits, because boycotts rarely affect revenue directly, said Mary-Hunter McDonnell, a professor of strategy at Georgetown University’s McDonough School of Business. “Really, boycotts are about threatening a company’s public image and reputation,” she said, and a tarnished brand can ultimately hurt the bottom line.

In the past, companies had to be careful not to offend groups that opposed homosexuality, said Bob Witeck, a corporate crisis consultant who specializes in gay issues. Two decades ago, Witeck helped American Airlines weather criticism over its decision to market to gays. His advice at the time was for the company to explain to the opposition that this was simply a good business decision.

But more recently, opinions have shifted dramatically to the point that it is a positive for some companies to be viewed as supportive of gay rights, particularly among young customers, who might view incidents such as the one articulated a year ago by Barilla as “stupid and backwards,” he said.

Starbucks, Nike and Microsoft, for instance, endorsed legalizing same-sex marriage in Washington state in 2012.

In the case of Barilla — a 130-year-old company based in Parma, Italy, that is the world’s largest pasta manufacturer — the blowback was fierce in September 2013 when Guido Barilla told an Italian radio host, “I would never do [a commercial] with a homosexual couple, not for lack of respect, but because we don’t agree with them,” according to reports. “Ours is a classic family where the woman plays a fundamental role.”

He continued: “If [gays] don’t like it, they can go eat another brand.”

The remarks grabbed headlines around the world and prompted boycotts in the United States, where the firm has 30 percent of the pasta market with $430 million in sales in 2013, and elsewhere. Harvard University dumped Barilla from its cafeterias, gay rights groups promoted names of other brands of pasta, and Barilla’s competitors seized on the opportunity to present themselves as more forward-thinking, with Bertolli Germany posting a comment on its Facebook page promoting “pasta and love for all!”

Guido Barilla issued multiple video apologies in the wake of the scandal. Barilla Group did not make Guido Barilla available for an interview, but in a statement, he apologized again, adding: “I am proud to say that, as a result of these discussions, we have all learned a great deal about the true definition and meaning of family, and over the past year we have worked hard to reflect that throughout our organization.”

Some of the gay advocates who have worked with Guido Barilla since his comments believe his contrition is sincere. “He was horrified at the consequences and his personal beliefs,” said David Mixner, a veteran gay rights activist and author who served as a consultant for Barilla.

He called the recent diversity initiative “the most all-encompassing effort to bounce back from an unfortunate misstatement that I’ve ever been part of.”

Seth Adam, a spokesman for GLAAD, a gay advocacy group that has also met with Barilla, said it is important to acknowledge someone when they have undergone an “evolution” in support of gay rights.

“I’m not giving anyone license to say things that are discriminatory,” he said. “However, I do think it’s okay to learn, and I think we’ve seen that in elected officials to everyday families.”

The company’s 100 rating in the Human Rights Campaign’s annual Corporate Equality Index, which is based on internal company policies as well as corporate citizenship, is remarkable, said Deena Fidas, director of the workplace program for the Human Rights Campaign. Last year, Barilla did not even ask to be rated. Of the 781 companies that volunteered to be rated this year, fewer than half got a perfect score.

“It is very unusual for a business to take on the full spectrum of CEI criteria in one year,” she said. “Some people may certainly speculate about the motivations here, but at the end of the day it’s irrefutable that at Barilla, you have LGBT-inclusive policies and practices . . . that were not there a year ago.”

Talita Erickson, chief diversity officer for Barilla, said that the company has demonstrated its sincerity with its actions. It has expanded its health benefits to include transgender-related care. It has instituted a thorough diversity training that all 8,000 of its workers will eventually undergo. It has broadened its anti-discrimination policy to cover gay and transgender people.

The company also has donated money to the Tyler Clementi Foundation, an anti-bullying organization founded by the parents of a gay Rutgers University student who committed suicide, and featured a lesbian couple on a Web site devoted to urging families to eat more meals together.

But will same-sex couples be turning up in any television commercials? Not immediately, said Erickson, who explained that the company did not want to be “reactionary” in light of the criticism.

“My understanding is we’re absolutely open to having the LGBT community represented in our ads in the future,” she said. “It’s going to happen gradually.”