Mozilla co-founder Brendan Eich is stepping down as CEO and leaving the company following protests over his support of a gay marriage ban in California.

The non-profit that makes the Firefox browser infuriated many employees and users last week by naming Mr. Eich head of the Mountain View, California-based organisation.

At issue was Mr. Eich’s $1,000 donation in 2008 to the campaign to pass California’s Proposition 8, a constitutional amendment that outlawed same-sex marriages. The ban was overturned in 2013 when the U.S. Supreme Court left in place a lower-court ruling striking down the ballot measure.

Mr. Eich’s contribution had drawn negative attention in the past but took on more weight when he was named CEO. Mozilla employees and users criticised the move on Twitter and elsewhere online. Earlier this week, dating website OKCupid replaced its usual homepage for users logging in with Firefox with a note suggesting they not use Mozilla’s software to access the site.

The departure raises questions about how far corporate leaders are allowed to go in expressing their political views.

“CEOs often use their station to push for certain viewpoints and get some muscle for those viewpoints,” said UCLA management professor Samuel Culbert. “But if you are going to play the game you have to think of both sides.”

Company leaders have to be conscious of what impact their own views may have on the success of their organisation, Mr. Culbert argues. While some leaders, such as Starbucks head Howard Schultz, have been outspoken in their political positions, it is often in a vein that is line with the ethos of his company. Mr. Culbert said that taking a position that is divisive can both drive away customers and hurt employee morale.

The onus is also on the corporation and its board to assess whether anything that a candidate has done or said in the past will adversely affect the company’s reputation, said Microsoft chairman John Thompson, who led a five-month search that culminated in Microsoft hiring Satya Nadella as its new CEO in February.

“When you run a public company or any visible organisation, what you think and what you say is always going to affect the company,” said Mr. Thompson, “You have to be mindful of how things you do and say will affect your customers, your employees and your investors.”

Mr. Eich said in a statement on Thursday that Mozilla’s mission is “bigger than any one of us, and under the present circumstances, I cannot be an effective leader.”

“I don’t think it’s good for my integrity or Mozilla’s integrity to be pressured into changing a position,” Mr. Eich said. “If Mozilla became more exclusive and required more litmus tests, I think that would be a mistake that would lead to a much smaller Mozilla, a much more fragmented Mozilla.”

At another point, Mr. Eich said that attacks on his beliefs represented a threat to Mozilla’s survival. “If Mozilla cannot continue to operate according to its principles of inclusiveness, where you can work on the mission no matter what your background or other beliefs, I think we’ll probably fail,” he said.

Mozilla chairwoman Mitchell Baker apologised for the company’s actions in an open letter online on Thursday, saying that Mr. Eich is stepping down for the company’s sake.

“We didn’t act like you’d expect Mozilla to act. We didn’t move fast enough to engage with people once the controversy started. We’re sorry. We must do better,” Ms. Baker wrote.

She said that Mozilla believes both in equality and freedom of speech and that “figuring out how to stand for both at the same time can be hard.”

Mozilla is still discussing what is next for its leadership.