It was a fierce and at times nasty battle that pitted competing visions and ambitions for the future of the Democratic Party against one another.
In the end, the New York progressives emerged victorious, and they now believe they have the momentum to change their party.
The race to determine who would be the Democratic candidate for New York City mayor had two distinct sides.
On one was the Democratic establishment — Andrew Cuomo, the former governor of the State of New York and scion of one of the country's most powerful political families.
On the other, the progressive insurgency — Zohran Mamdani, a 33-year-old Muslim and self-declared "Democratic socialist" and critic of capitalism who was promising to hike taxes on the rich.
In the end, New York City voted for the younger and far less experienced Mamdani to be its Democratic candidate for mayor, shocking the party establishment and lighting a fire under the progressives who are ready to march further to the left.
From the position of president, down to school boards in some local counties, Americans get to vote on who they want to hold power, but they also get to vote on the candidates that end up on the ballot via primaries.
While Donald Trump and his MAGA movement have ascended and now reign supreme over the Republican Party, there is a battle going on inside the opposition.
Since the defeat of Kamala Harris in November, the Democratic Party has been in the throes of an identity crisis.
Some believe future electoral success lies in embracing the left fringe of the party, others want the centre to hold.
Now progressives have had a major win.
With 43.5 per cent of the vote in the first round, Mamdani is now poised to run as the party's candidate for mayor of New York at the general election on November 4.
Mamdani ran a slick social media heavy campaign, and with liberal uses of celebrities, built a grassroots effort that propelled him to victory.
"This is not just about New York, this is about the Democratic Party. It's about the hope that we have … that people can win elections, not just money," said celebrity Emily Ratajkowski as she endorsed Mamdani.
Voters opted for the man with the shorter resume over someone with a problematic one. Cuomo had been backed by billionaires and as a former governor Cuomo had name recognition, but New Yorkers also could not forget the sexual harassment allegations levelled at him.
Mamdani's victory has energised the progressive wing of the Democratic Party. They've seized on his success as evidence that a bold left-wing platform can be electorally successful.
But that narrative is already being contested by centrist and moderate members of the party who argue a campaign like Mamdani's might work in inner cities, but will not translate to the suburbs of middle America which determine elections.
Either way, Mamdani's win does a few things.
It gives progressives momentum, rattles the party establishment and presents an opportunity to Donald Trump and his Republican army.
Who is Zohran Mamdani?
A few short months ago, you would have struggled to find anyone who had heard of Zohran Mamdani outside of local politics and now he is being lionised and pilloried by some of America's biggest political players.
His life story became a big part of his campaign. He was born in Kampala in Uganda to a family of Indian ancestry before he moved to New York at age seven.
His mother, Mira Nair, is a well-known film director and his father is Mahmood Mamdani, is a professor at Columbia University, specialising in the study of colonialism.
Mamdani is married to artist and ceramicist Rama Duwaji who was attacked online by right-wing trolls throughout the campaign. The couple met on Hinge.
If the people of New York back Mamdani at the general election, he'd be the first South Asian and first Muslim mayor.
He would also be an anti-capitalism mayor in a city that was arguably the birthplace of the United States free market-loving economy.
Before his political career, Mamdani worked in film and as a writer.
He even had his own short-lived hip hop career as Mr Cardamom, with lyrics like: "I'm your boss, I'm your f**king Nani. Got a doctorate bitch, so don't f**king try me."
Mamdani ran on a hyper progressive agenda. He has been promising free buses, rent freezes, tripling the production of rent stabilised housing and to develop a chain of city-owned grocery stores to bring down the prices of basics.
But perhaps the most contentious issue in this campaign was his position on Israel and Palestine, despite the New York mayor not having any foreign policy responsibilities.
Mamdani's long standing activism on behalf of Palestinians and staunch criticism of Israel was seized upon by his opponents.
Mamdani has accused Israel of committing genocide in Gaza and practising apartheid. He's even said he'd arrest Benjamin Netanyahu, if the Israeli prime minister was to visit New York while he was mayor.
New York City, with an estimated 1.5 to 2 million Jews, is often considered to be the second largest Jewish city in the world, after Tel Aviv.
The conventional political view has been, until now, that to be successful in New York, a candidate needed to be pro-Israel.
That was the track Cuomo was running, describing himself as a "hyper supporter of Israel and proud of it".
Andrew Cuomo came to this race with heavy baggage, which weighed down his popularity. He stood down as governor of New York state in 2021 after being accused of sexual harassment by multiple women.
The Justice Department found Cuomo had repeatedly subjected women in his office to non-consensual sexual contact. Cuomo continues to deny he did anything illegal.
But Cuomo was well supported by the Democratic establishment.
And he was backed by billionaires like former mayor Michael Bloomberg and investor Bill Ackman.
Bill Clinton also backed Cuomo, who'd once served as his secretary of housing urban development, with the former president saying: "It is imperative that New York chooses a mayor who has the ability, talent, and experience to do the job."
While Cuomo's campaign did its best to paint Mamdani as ill-equipped for the job of running a city with a $115 billion budget and that employs about 300,000 workers, the voters were not swayed.
Trump's people see a political play
Republicans seem to think Mamdani's win and the Democrats that delivered it have handed them a major advantage in other races.
They are doing their best to elevate Mamdani to national prominence.
Vice President JD Vance has been calling him "the new leader of the Democratic Party".
While President Trump has been calling Mamdani a "100% Communist Lunatic".
The National Republican Congressional Committee labelled him as an "antisemitic socialist radical".
While Mamdani rejects any claim he's an antisemite, he embraces the term socialist.
Basil Smikle, a political analyst and professor at Columbia University’s School of Professional Studies, said heavy-handed attacks on Mamdani could backfire by energising "a lot of the Democratic voters to want to push more against Trump".
"I don't think it hurts Democrats in the long run," he said. "I actually think it helps them."
Mamdani has paid credit to another high-profile "Democratic socialist", Vermont senator and former presidential candidate Bernie Sanders, calling him "the single most influential political figure" in his life.
Sanders said Mamdani's victory was due to a "brilliant campaign" and claims Kamala Harris would be president today if she had followed the Mamdani playbook.
In addition to Sanders, perhaps Mamdani's most important endorsement came from Congressional representative Alexandria Ocasio-Cortez , more commonly known as AOC.
She threw her weight behind his bid in the final weeks of the campaign.
"Assemblymember Mamdani has demonstrated a real ability on the ground to put together a coalition of working-class New Yorkers that is strongest to lead the pack," she said.
AOC is the most high-profile member of the progressive wing of the party. She's been suggested as potential president candidate in 2028 or may launch a bid to unseat the long serving senator Chuck Schumer.
But while the progressive wing is basking in the glow of the unexpected New York victory, the party is split on what the win means.
Democratic strategist Tim Lim told Politico: "For moderates and wealthy Democratic donors, the reaction is, this is horrible and it's going to ruin us."
"For centre-line Democrats who don't necessarily support Mamdani's policies, the reaction is, this is a rejection of the Democratic establishment and Mamdani ran a great campaign against a sex offender.
"And for progressives, they believe this is what happens when you listen to voters."
For his part, Mamdani seemed ready to embrace any role as a party leader, telling supporters in his victory speech that he would govern the city "as a model for the Democratic Party – a party where we fight for working people with no apology".
He vowed to use his mayoral power to "reject Donald Trump's fascism".
The November battles
Mamdani will go to the general election in the mayoral race this November. Next November, the United States will vote in midterm elections, which will be the first real test of national sentiment towards the second Trump presidency.
By November 2028, the Democratic Party will have to have figured out how to defeat whoever takes over the MAGA mission.
While Mamdani's primary victory was a seismic shock to the party, it will be but a blip if he doesn't become mayor in November and that is by no means a lock.
It's a crowded field. He'll be facing the current Mayor Eric Adams who previously won as a Democrat before leaving the party when it was clear he would not win the primary.
Andrew Cuomo is also leaving the door open to a run as an independent and there will also be a Republican flag-bearer.
It is also likely to be a well-financed contest.
Billionaire Bill Ackman has already promised to bankroll a rival. He has claimed he and his allies are willing to spend "hundreds of millions of dollars" to ensure Mamdani does not emerge victorious.
While Mamdani's pledges to hike taxes and expand services won over New York's Democrats, it might be a different matter once Republicans and independents are given their chance to make a pledge to voters.
The ranked choice system New York uses for its elections, which is similar to Australia's preferential system, also rewards moderation so it is possible it will work against him when there are more centrist candidates competing.
But win or lose in November, Mamdani has delivered a message to the party's most powerful at a time when there is a vacuum of strategy and direction.
By running on a platform that represents, not the top 1 per cent, but the other 99, Mamdani pulled off a monumental political upset.
"Cost of living is the issue of our time," Neera Tanden, the chief executive of Democratic think tank Center for American Progress wrote on X in response to Mamdani's win.
"It's the through line animating all politics. Smart political leaders respond to it."
ABC/Reuters