CAMBRIDGE, Mass. — As Sen. Elizabeth Warren unwinds her presidential campaign, she faces one more decision that will shape the role she will play in coming months and years: Will she endorse one of the major Democrats still running for president, and if so, which?

The choice at hand — between former vice president Joe Biden and Sen. Bernie Sanders (I-Vt.) — is in a sense the latest version of a choice Warren has confronted throughout her political career, whether to align with the establishment and its leaders or join forces with the outsiders.

Warren has long resisted making this kind of decision, or even accepting the conventional notion of insiders vs. outsiders. But the pressure to endorse will only grow stronger as Biden tries to cement his lead and Sanders attempts a comeback.

Warren ended her campaign Thursday after disappointing election results, but her year-long effort won her throngs of supporters, especially among girls and women, burnished her policy credentials and made her a household name. The Biden and Sanders camps have been courting her team assiduously.

Backing Sanders is the clearer ideological choice and would further secure her role as a leader of the left. But it carries risks, since Sanders’s path to the nomination has narrowed and Warren has made it clear she is uncomfortable with the online vitriol unleashed by some of his supporters. Moreover, many players in Warren’s orbit harbor deep reservations about Sanders’s capacity to effectively lead the government.

Supporting Biden, who is surging at the moment, could allow Warren to push her agenda from inside the Democratic Party and possibly a Biden White House. But his political philosophy departs significantly from hers on key issues like trade and health care.

Another option is to embrace neither candidate until one becomes the nominee.

“She’s created her own brand and she’s achieved something that very few people in politics achieve, which is to be on the inside but be the most effective force for those on the outside,” said former Housing Secretary Julián Castro, who endorsed Warren after ending his own presidential bid.

“I’m not quite sure what she’s going to do,” said Castro, who last spoke with her Wednesday as she was weighing whether to continue her campaign.

Warren sat on the sidelines for most of the 2016 campaign, refusing to back either Sanders or eventual nominee Hillary Clinton despite considerable pressure from both sides. She was the only Democratic female senator to skip a big endorsement event for Clinton, making headlines for her absence.

But once it was clear that Clinton would emerge as the nominee, Warren endorsed her and pushed to become her running mate. When she was passed over in favor of Sen. Tim Kaine (D-Va.), Warren kept pushing from the inside, for example preparing lists of liberals that she hoped the Clinton team would use to staff the new administration.

Some of Sanders’s supporters started the 2020 campaign still angry that Warren had not enthusiastically backed Sanders, her ideological ally in the party’s liberal wing. Warren moved further to the left after the 2016 campaign — co-sponsoring Sanders’s Medicare-for-all bill and backing his choice to lead the Democratic National Committee — in part to make amends to him and his backers, according to a person familiar with her thinking who spoke on the condition of anonymity because the person was not authorized to discuss internal deliberations.

Warren has been both a team player and an outside critic during her career. After the financial crisis of 2008, as a Harvard law professor, she worked closely with Democratic members of Congress to create the Consumer Financial Protection Bureau, an agency aimed at reining in banks. But she also has blasted fellow Democrats for supporting banking bills she thought were too friendly to Wall Street.

People close to Warren say she will now be guided by a determination of how best to push her agenda, which involves providing government support and protection for middle- and working-class Americans.

“She’s going to make whatever moves she thinks best advances the policy ball for her, and she’s going to show just how creative she can be with this,” said Adam Levitin, a Georgetown Law professor who is close with Warren and helped formulate some of her policies. “Because the presidency, for her, was a means not an end, there are other ways she can pursue the policy outcomes.”

When Warren was new to Washington, she had a well-documented dinner with Larry Summers, one of then-President Barack Obama’s top economic advisers, at the Bombay Club, an Indian restaurant near the White House. Their discussion included what Warren, in her book “A Fighting Chance,” described as a warning: She had to choose between being an insider or an outsider.

The outsider gets to say what she wants publicly, but nobody listens internally, Summers said, according to Warren. The insider gets access and a voice in the important rooms but must be careful about what she says publicly — particularly about fellow insiders.

Warren instead wanted the benefits of both.

“That’s maybe part of why she didn’t endorse anyone, because she really still wants to be both,” said one person familiar with how Warren approaches Washington, who spoke on the condition of anonymity to be candid about the matter.

“And she hasn’t wanted to choose,” the person said. “Maybe she will choose or maybe she will try to be a part of bringing the party together after a choice has been made by the people.”

Warren frequently discussed the “insider” vs. “outsider” roles on the campaign trail, saying she wanted to build a movement that would be an outside force supporting her administration’s attempts to make “big, structural change.”

But now that her campaign is over, Warren faces the prospect of taking on a different role. During her run, she won praise for her well-organized campaign operation, verbal and intellectual deftness, and detailed policy proposals. She built a following among many voters across the country, giving her additional clout.

That raises the stakes for her endorsement and beyond. Warren provided hints about her views of Biden and Sanders in a lengthy interview Thursday with MSNBC’s Rachel Maddow. Though she is typically laser-focused on policy, Warren put that aside and instead discussed the character of the candidates and their campaigns.

When it came to Biden, Warren acknowledged their fights from the 1990s. “We go back a long way. We were in the bankruptcy wars against each other,” Warren said, referring to a defining legislative battle when she was a law professor.

But she said that fight does not define her views of Biden. “He’s a decent guy, and it comes through in pretty much everything he does,” she said.

When Maddow noted that the two differ on many policies, Warren agreed but also said they have “agreements on a number of core policy issues.” She added, “My whole life has been about working families, and more, about how government should be there to be on their side. I believe that the vice president has the same goal.”

When asked about Sanders, Warren cited their long friendship and reminisced about the time her husband, Bruce Mann, drove her to Vermont to participate in town halls with Sanders.

But her tone changed when discussing his campaign. “There’s a real problem with this online bullying and sort of organized nastiness,” Warren said. “I’m talking about some really ugly stuff that went on.”

She noted that several woman from groups that disagreed with Sanders’s positions were physically threatened. Sanders has disavowed such incidents while saying that the vast majority of his supporters are decent and that his backers, too, have been subject to taunts.

“We are responsible for the people who claim to be our supporters and do really threaten, ugly, dangerous things,” Warren said, adding that she does not want to “follow the same kind of politics of division that Donald Trump follows.”

Warren added: “It’s not who I want to be as a Democrat. It’s not who I want to be as an American.”

Scott Clement and Emily Guskin contributed to this report.