Malcolm Turnbull, the Australian prime minister who was forced out of office after a brutal leadership showdown on Friday, once likened the country’s revolving door political leadership to a soap opera or a gangster movie.

“But a script like that wouldn’t be green-lighted,” Turnbull said in 2012 as he poked fun at the leadership drama that was then engulfing the other side of the political aisle. “Fiction, after all, does have to be credible.”

This week, however, Turnbull became the latest victim of Australia’s habit of removing prime ministers midway through an electoral cycle.

Former treasurer Scott Morrison was sworn in as the country’s sixth prime minister in a decade on Friday, after narrowly winning a leadership ballot among lawmakers of the ruling center-right Liberal Party.

President Donald Trump congratulated Morrison on Friday evening.

Congratulations to new Australian Prime Minister Scott Morrison. There are no greater friends than the United States and Australia! — Donald J. Trump (@realDonaldTrump) August 25, 2018

'Dodged a bullet'

After it become clear that Turnbull’s party had lost faith in his leadership, Morrison put himself forward as a more palatable alternative to the main challenger, Peter Dutton, who was backed by right-wing forces and is seen as a divisive figure on migration and race issues.

Dutton once boycotted a historic national apology to Indigenous Australians for past mistreatment. In his leadership campaign, Dutton had indicated an interest in cutting immigration and pushing hard on law-and-order issues in a bid to reconnect with disaffected voters.

The Liberal Party has been concerned about some of its supporters drifting to the One Nation party, led by firebrand Sen. Pauline Hanson, who has called for a ban on wearing the burqa in public and argued Australia is "in danger of being swamped by Muslims."

Peter Dutton speaks during a news conference in Canberra on Tuesday. Mark Graham / Getty Images

One political commentator, Katharine Murphy of The Guardian, wrote that Australia had “dodged a bullet” with Dutton's defeat at a time when many countries were succumbing to populist forces.

Still, the pain for Turnbull was raw.

“Australians will be just dumb-struck and so appalled by the conduct of the last week,” Turnbull, who is from the moderate wing of the party, said after the vote on Friday.

He was at least relieved that Dutton — whose supporters had forced Turnbull to hold the leadership ballot — had failed at the final hurdle, noting that his former home affairs minister was not “rewarded” for being part of a “determined insurgency.”

“We must never allow the politics of race or division or of setting Australians against each other to become part of our political culture,” Turnbull added.

Morrison later said it was important “to keep our country together” and “not pit one group of Australians against another.”

While he is widely viewed as more moderate than Dutton, Morrison rose to public prominence in 2013 as the immigration minister who stopped asylum seekers from attempting to reach Australian shores by boat.

A committed Christian and staunch social conservative, he also proved out of step with most Australians last year when he supported the "no" campaign during a public vote on whether to legislate to allow gay marriage.

Spilling over

In Australia’s parliamentary democracy, the prime minister is not directly elected by voters but is the leader of the party that enjoys a majority on the floor of the House of Representatives.

Lawmakers can call for a “spill” declaring their party’s leadership open at short notice. When a governing party’s parliamentarians vote to install a new leader, the appointee is soon afterward sworn in as prime minister, too.

Almost three years since seizing power himself in a late-night coup, Turnbull has now become the fourth prime minister to be dumped by his or her own party before serving a full term since the revolving door to the prime minister's office started in 2010.

A former lawyer and merchant banker, he has always been viewed with suspicion by the more conservative elements in his party and its supporter base, particularly for his progressive views on social issues and his past support for strong action on climate change. He regularly describes Australia as “the most successful multicultural society in the world.”

Ousted Australian Prime Minister Malcolm Turnbull. Atsushi Tomura / Reuters file

Turnbull has been under political pressure for months with his party lagging behind the center-left Labor Party in the polls and divided over a proposed new energy policy. With the government clinging to a one-seat majority in the House of Representatives, any contentious bill is vulnerable to defections.

With former police officer Dutton getting ready to pounce, Turnbull tried to catch him out by calling a "spill" on Tuesday. His victory in that leadership ballot was just a temporary reprieve, however, as Dutton forced another vote on Friday morning.

Turnbull then decided against putting his name forward in the ballot, surrendering his grip on power to give his ally and top economic minister Morrison a better chance of victory.

Dutton's and Turnbull's camps waged the most chaotic, frenetic and at times farcical leadership struggle that Australian politics has seen in years, closing down Parliament's lower house on Thursday and damaging the Liberal Party's credibility.

In his first press conference after the leadership ballot on Friday, Morrison tried to draw a line under the saga by promising voters the focus would return to them.

“We are on your side,” Morrison said in a message aimed directly at Australians watching the live broadcast. “The work of government continues.”

Australians have, of course, heard versions of this same script before. Whether they find it credible will become clear when they finally have their say at the next election, due by next May.