CAMBRIDGE, Mass. — Elizabeth Warren attracted big crowds. She won rave reviews in nearly every debate. Her organization was second to none. She developed plans, a strategy and a message. Yet when voting started, she not only lost, she lost by a lot.

Now as Warren, who ended her presidential campaign Thursday, decides whether to endorse either of the two male candidates remaining, her supporters are left to contemplate a factor that many believe contributed significantly to her loss: She’s female.

“Gender in this race, you know, that is the trap question for every woman,” Warren told reporters gathered outside her house Thursday. “If you say, ‘Yeah, there was sexism in this race,’ everyone says, ‘Whiner!’ And if you say, ‘No, there was no sexism,’ about a bazillion women think, ‘What planet do you live on?’ ”

It felt like an echo from 2016, when a high-profile female candidate with strong qualifications fell short, and the loss renews questions about the perceptions of women in American politics and if, or how, those perceptions can be changed.

It’s not that Warren ran an error-free campaign. She had to apologize for previous claims of a Native American identity and struggled to explain her health-care plan and how it would be paid for, and her efforts to bridge the party’s liberal and centrist camps fell flat.

But her male counterparts made big mistakes as well. And Warren was among six accomplished women who got little traction in a party that recaptured the House in 2018 with a record number of female candidates, elevated a woman as House speaker who regularly goes toe-to-toe with President Trump, and ostensibly has a new sensitivity to gender issues.

The exit by Warren, who spent much of 2019 leading in many polls, was a reminder of four years ago, when Hillary Clinton’s loss sparked a national debate over whether a woman could ever win election to the country’s highest political office. Her departure came just days after another prominent female senator, Amy Klobuchar, dropped out.

“Women will not be perceived by some as electable until we’re elected,” said Valerie Jarrett, a top adviser to former president Barack Obama and a friend of Warren’s. “I often say progress always seems impossible until it’s inevitable. There was certainly a time when our country might have thought that an African American man was not electable. And what happened? We just kept trying.”

After campaigning energetically for more than a year, Warren finished no higher than third in any primary or caucus, and on Tuesday, she finished behind former vice president Joe Biden and Sen. Bernie Sanders in her home state of Massachusetts.

Voters repeatedly told Warren’s campaign workers that Clinton’s shocking loss to Trump had spooked them, suggesting they blamed it on Clinton’s gender, rather than other factors like her moderate ideology failing to excite the Democratic base.

Warren’s campaign tried a variety of tactics to win support from voters who embraced her policies but could not quite believe that enough people would choose her over Trump, which her staff referred to as the “electability problem.”

She held massive rallies in New York, Seattle and St. Paul, Minn., intended to showcase her popularity. She disassembled a billionaire presidential candidate on a debate stage, effectively ending former New York Mayor Mike Bloomberg’s White House bid, partly as a way to show how she’d potentially eviscerate Trump in the fall.

Her campaign trained volunteers about how to talk about what aides called the “elephant in the room” when they campaigned door-to-door.

Warren herself on occasion sought to defuse the issue by speaking about it bluntly.

“Look at the men on this stage. Collectively they have lost 10 elections,” Warren said during a January debate. “The only people on this stage who have won every single election that they’ve been in are the women, Amy and me!”

None of it worked.

“We’re comfortable with women leaders in the abstract,” said Jennifer Palmieri, who was Clinton’s communications director in 2016 and has written two books on gender in politics. “But once they actually start winning or getting close to power, that is when all of the sexism and unconscious gender bias kicks in.”

She recalled hearing Democrats four years ago talk about how they disliked Clinton but adored Warren. Once Warren was poised to take power, however, new questions arose about whether she lacked some intangible attribute needed to win the White House, Palmieri said.

“It’s an unsatisfactory answer for people because it sounds so ridiculous to say, but we are not comfortable with women having very big ambitions,” Palmieri said.

Clinton’s defeat in 2016 devastated her supporters, and Warren’s withdrawal was similarly greeted Thursday with disappointment and frustration.

“The best candidate of them all had to quit,” former tennis star Martina Navratilova said via Twitter. “She had a plan for everything with one major thing missing — the ‘right’ sex... Let’s be real. This is not playing the gender card, it’s just a fact.”

Warren’s withdrawal also prompted other leading women in Washington to reflect on why the “highest and hardest” glass ceiling that Clinton once talked about was still intact.

“Every time I get introduced as the most powerful woman in the United States, I almost cry, because I’m thinking, ‘I wish that were not true,’ ” House Speaker Nancy Pelosi (D-Calif.) told reporters. “I so wish that we had a woman president of the United States, and we came very close to doing that — [a] woman who was better qualified than so many people who have sought that office and even won it.”

Pelosi added that she believes there is “a certain element of misogyny” preventing women from rising.

Still, the Democratic primary has been unusually complicated this year, and many argue that other factors besides sexism were at play in Warren’s fate. Her initial strategy rested on quickly consolidating the left, for example, but many liberals, such as Rep. Alexandria Ocasio-Cortez (D-N.Y.), were more drawn to Sanders’s brand of fiery democratic socialism.

Then Warren sought to present herself as a bridge-builder, challenging the notion that there were only centrist and a liberal “lanes” in the primaries. “I thought that wasn’t right, but evidently I was wrong,” she said Thursday.

Warren was the remaining woman among a group that included Sens. Kirsten Gillibrand (D-N.Y.), Kamala D. Harris (D-Calif.) and Amy Klobuchar (D-Minn.) along with self-help guru Marianne Williamson. Only Rep. Tulsi Gabbard (D-Hawaii) remains in the race, but she lags far behind Biden and Sanders.

The next big task facing Warren is deciding whether to endorse another candidate. She would have to choose between the two men remaining, both of whom have had their own issues with treatment of women.

On one side is Sanders, an ideological ally whose leadership style and management ability are questioned by many in Warren’s orbit. In 2016, Sanders faced complaints about how women on his staff were treated, and he ultimately apologized for that.

Or she could back Biden, who some women have accused of inappropriate touching and who has ties to the same corporate interests she reviles. She also could decide not to endorse.

Both camps have been reaching out to Warren’s team in some fashion since Wednesday, when she signaled she was reassessing her candidacy.

At a news conference Thursday outside her home in Cambridge, Warren told reporters she would not immediately make an endorsement in the presidential race but may do so in the future. She urged people to “take a deep breath” before moving on and pledged to keep battling for ­middle-class families.

“I have to think a lot about where is the best place for me to go to keep fighting those fights,” Warren said. “My job is to fight them as smartly and effectively as I can.”

Warren initially kept her messaging about gender low-key when on the campaign trail: She made “pinkie promises” with young girls who came to her town halls, for example, telling them she was running for president “because that’s what girls do.”

But late last year, as she lost some momentum and the number of women in the field dwindled, Warren began to talk more directly about gender, focusing on the wave of women who “came off the sidelines” after Trump’s inauguration and helped elect female candidates to Congress and other offices in 2018.

In January’s Democratic debate, moderators poked at a dispute that had been brewing for days between Warren and Sanders over a private meeting in 2018 during which Sanders reportedly said a woman could not win the presidency.

Onstage, Sanders flatly denied making any such remarks. “How could anybody in a million years not believe that a woman could not be president of the United States?” Sanders said.

Warren, who insisted she was “not here to try to fight with Bernie,” said she disagreed with Sanders — suggesting he had in fact made those remarks — adding that she wanted to address head-on the question of a woman’s electability.

In February, Warren was asked whether she thought women were judged by a double standard on the debate stage.

“This is what women face all the time — it’s always ‘too much of this’ or ‘too much of that,’ ” Warren told MSNBC. “But you put your head down, do your job and you keep on going. Or, you might say, ‘We persist.’ ”

The “persist” slogan reflected her self-described identity as a relentless fighter who never gives up. In 2017, Senate Majority Leader Mitch McConnell (R-Ky.) warned Warren that she was violating Senate rules during a floor speech, saying: “She was warned. She was given an explanation. Nevertheless, she persisted.” Warren and her supporters eagerly seized on the phrase.

And last month when a group of women decided to form a super PAC to support Warren’s candidacy, the crusader against big money used gender as a reason to accept the help of a committee that could raise unlimited amounts of cash.

“We reached the point a few weeks ago where all the men who were still in this race and on the debate stage all had either super PACs or they were multibillionaires,” Warren said, explaining her reversal. “It can’t be the case that a bunch of people keep them and only one or two don’t.”

Warren’s super PAC spent more than any of the other Democratic candidates’ outside group this year. Ultimately, it didn’t make a difference.

John Wagner and Felicia Sonmez contributed to this report.