William F. Weld, the former governor of Massachusetts, narrowly won the Libertarian Party's nomination for vice president Sunday after a surprisingly bruising convention at which the former Republican was twice compelled to pledge lifelong allegiance to his new party.
Gary Johnson, the former Republican governor of New Mexico who won the Libertarian nomination for the second time Sunday, had chosen Weld as his running mate on May 18. But many of the 900-plus convention delegates meeting in Orlando, Fla., were reluctant to go along with that plan, expressing so much skepticism about Weld that Johnson ended up pleading for their support.
"Give me Bill Weld, and I will give you the best effort I possibly can going forward," Johnson said. "Please, please, please."
In recent days, Weld's nomination — and his sharp, high-profile exchanges with Donald Trump — had called unusual attention to the marginalized Libertarian Party, boosting the party's profile and, potentially, its fund-raising.
But it also created division in the party, which has been trying to capitalize on the conflicts within the major parties to present itself as a credible alternative.
In an election cycle that has upended all expectations — and that features two likely presidential candidates who voters love to hate — the Libertarians are viewing this election cycle as an unusual opportunity. Speaker after speaker Sunday excitedly noted their party was commanding attention, trending on Twitter, leading The New York Times home page.
They were even drawing the attention of the king of showmanship — Trump.
But the convention descended into discord as Weld's nomination was considered. The former governor was lustily booed and heckled, accused by one opponent of having "sold his soul to the GOP."
On the first round of ballots, Weld led the field of five candidates, but he failed to capture a majority of votes, leading to a second round of voting and a protracted, nerve-racking tally.
By this time, the disorder in the room had shifted into something approaching paralysis.
A large bearded man seized the stage and began performing a hapless striptease. No one stopped him — though several later called for ejecting him from the party. That created an unexpected conundrum for a group of people who fervently believe in staying out of other people's business.
Afterward, when asked whether the stripping incident would feed a Libertarian Party image problem, Johnson told reporters, "I don't think free-wheeling — crazy if you will — is unique to Libertarians. I think Republicans have got them and Democrats have got them. Look, we're a family. It's OK. It's OK."
Johnson ran for president as the Libertarian candidate in 2012, garnering about 1 percent of the vote.
Weld did his best to disarm doubters, saying he had always embraced Libertarian principles. Still, when he addressed the delegates, he acknowledged his new status: "It's been 14 days since I became a member of the Libertarian Party, and I feel the better for it."
He called it a "relief" to shed the burden of the "Republican Party's antichoice, antimarriage equality" social policies that he had carried for decades.
"This is how we should all feel: Free, free at last!" Weld declared.
And, he promised: "If you hear nothing else from me, hear this: I pledge to you that I will stay with the Libertarian Party for life."
A Republican who crossed party lines to endorse Barack Obama for president in 2008, Weld had alienated Libertarians in New York in 2006, when he flirted with a run for governor there. He'd already accepted the Libertarian endorsement for governor and pledged to stick with it, then bowed out of the race after failing to win the backing of the Republican Party.
His fellow former Republican governor, Johnson, told the delegates that he views this election as an "opportunity to exponentially grow the party" and that Weld would be key to helping him do that.
Unlike Johnson, who estimates he may have raised $8 million over the course of his political life, Weld has raised closer to a quarter of a billion dollars, Johnson said. He also said he thinks Weld's involvement could vault the Libertarian team into a televised debate.
"If it's not Bill Weld, I don't think that that happens," Johnson said. "But if it is Bill Weld, there's a real possibility we could achieve major party status in this election and who would have dreamed that would be possible four years ago?"
But delegates continued to raise reservations. Alicia Dearn, another contender for vice president, asked Weld to return to the stage to "pledge to our party that he will not betray us and that he is not a Republican."
Looking sheepish, Weld took the stage a second time to reiterate what he'd already said: "I'm a Libertarian for life."
Still, his comments were met with boos and taunts from the audience.
Weld tried again: "Libertarian for life means not go back to any other party. Just for the sake of clarity."
When the booing continued, Weld waited, looking uncertain, conferring with Dearn. Finally, he restated his intentions this way: "If rejoining another party means a betrayal of the Libertarian Party, yeah, no, I will not do that."
It wasn't enough for everyone — not even for Dearn, who had drawn it out of him.
"I'm going to vote my heart and I'm not sure even what that is yet," she said onstage.
Ultimately, though, she came around, and urged her fellow delegates to support Weld, noting that their presidential nominee chose him. Weld prevailed with little over 50 percent of the vote on the second ballot. He was not available for comment late Sunday night.
"It's time to unify behind a ticket," Dearn told the crowd. "Donald Trump is already making fun of us!"
As if that were the greatest recognition of all.
Stephanie Ebbert can be reached at Stephanie.Ebbert@globe.com. Follow her on Twitter @StephanieEbbert.