Australia's ruling conservative coalition defied expectations to retain power in national elections Saturday, prompting Prime Minister Scott Morrison to declare: "I have always believed in miracles!"
"How good is Australia!", shouted a jubilant Morrison, who came to office just nine months ago in a party coup against his moderate predecessor, Malcolm Turnbull.
While it remained unclear if Morrison's Liberal party and their rural-based National party partners would win enough seats to form a majority government, the leader of the main opposition Labor party conceded defeat shortly before midnight.
"It is obvious that Labor will not be able to form the next government", Bill Shorten told stunned supporters in Melbourne.
"In the national interest, a short while ago I called Scott Morrison to congratulate him," Shorten said, adding that he would also stand down as leader of his party in the wake of its shock defeat.
The result was a monumental upset and a failure by pollsters, who had for months predicted a comfortable victory for Labor after six years in the opposition.
Some bookies had paid out early expecting a coalition defeat and all but the most ardent partisans had thrown in the towel.
The results appeared to show a fractured electorate with minor populist and right-wing parties playing an outsized role in tipping the balance in favour of the conservatives in key districts in the northeast of the country.
They include Pauline Hanson, whose party shrugged off revelations her party solicited money from the US gun lobby and Clive Palmer -- dubbed Australia's Donald Trump -- who splashed tens of millions on a populist campaign.
Australia has compulsory voting and a complex system of ballots ranked by voter preference, with big political, economic and cultural differences from state to state on the vast island-continent.
'Snatched a win'
Many of the laurels for victory will go to Morrison, who just weeks ago looked set for an electoral drubbing, fated to enter the history books as one of the most short-lived prime ministers in Australian history.
But he closed the gap with a negative campaign and backing from the country's biggest media organisation -- owned by Rupert Murdoch -- mainly targeting older, wealthier voters concerned over Labor plans to cut various tax loopholes in order to fund spending on education, healthcare and climate initiatives.
"Labor campaigned hard on a big target strategy with a series of key tax concessions, that ultimately seem not to have resonated with voters," said Rob Manwaring, a political lecturer at Flinders University in Adelaide.
"Despite the wider fragmentation of the right in Australia, they have snatched a seeming win," he told AFP, calling the coalition victory "extraordinary and surprising".
Liberal supporters were ecstatic over the result.
"Unbelievable," gushed Anthony Ching at the Liberal party headquarters. "Everybody was expecting that we were not going to win."
Labor backers were disconsolate.
"I think Morrison campaigned on fear, and people have fallen for it," Julie Nelson, 67.
Climate change had featured prominently throughout the campaign.
Australia is one of the most vulnerable of all developed nations to climate change and a season of record floods, wildfires and droughts has brought the issue from the political fringes to front and centre of the campaign.
In traditionally more conservative rural areas, climate-hit farmers are increasingly demanding action, while in several rich suburbs, a generational shift has seen eco-minded candidates running Liberal party luminaries close.
In northern Sydney, former prime minister Tony Abbott -- who once described climate change as "crap" -- lost a seat he has held for a quarter century to independent challenger Zali Steggall, a lawyer and Olympic medallist in Alpine skiing.
While admitting his own defeat, mainly over the climate issue, Abbott claimed there had been a "realignment" in Australian politics with Liberals winning more of the working class vote, adding: "I'm not going to let one bad day spoil 25 years".
The national campaign has been an often ill-tempered pitched-battle. Candidates have been egged and abused, and a slew have resigned for racist, sexist and otherwise jaw-dropping social media posts.