Scott Morrison planned his assault on the Liberal Party leadership for months, according to senior cabinet sources.

The story of how he replaced Malcolm Turnbull is one of ambition, doublecrossing and outfoxing, with Home Affairs Minister Peter Dutton as an unwitting stooge.

Last week, while positioning himself as a compromise candidate, Morrison and his supporters played off Dutton and Turnbull against each other. Only now have their key supporters realised what happened.

They believe both contenders had been undermining Turnbull with their own ambitions in mind and, in Dutton’s case, with at least the tacit support of Finance Minister Mathias Cormann. Cormann denies this.

Senior figures told The Saturday Paper that before last month’s Longman byelection in Queensland, Turnbull wanted to dump his plan to legislate tax cuts for the biggest companies in Australia – effectively the big banks – because it was clear they would be electoral poison.

But two senior cabinet colleagues opposed him: Morrison and Cormann.

The poor showing in Longman became the catalyst for a leadership challenge.

The Liberal National Party recorded an appallingly low vote and, since then, some colleagues say the two contenders’ camps have been jockeying to be best positioned for when the time was right.

A week before the final challenge, Dutton gave an interview to Radio 2GB host Ray Hadley and set the leadership hares running.

It was more than 24 hours before he issued a Saturday statement on Twitter – at Cormann’s urging – pledging his ongoing support for Turnbull.

But the media frenzy had begun.

Caught off guard and without time to lobby, Dutton’s supporters were jubilant at how well their candidate had done.

Turnbull shifted a scheduled Sunday cabinet dinner from The Lodge, where ministers would have had to run the gauntlet of cameras and shouting journalists, to the relative privacy of Parliament House.

The Saturday Paper understands Dutton had told Turnbull he couldn’t get from Brisbane to Canberra in time for the meeting, so Turnbull sent an RAAF VIP aircraft to get him.

Cabinet colleagues noted that Dutton and Cormann both arrived late, at the end of dinner.

Asked if he had been helping Dutton for some time, Cormann said: “The answer is a clear no.”

Between Sunday night and Tuesday morning, then prime minister Turnbull realised the rumoured moves against him were genuine.

Queensland backbencher Luke Howarth told colleagues privately on Monday that he planned to stand up in the party room the following day and ask Turnbull to step down. He confirmed this to The Saturday Paper this week.

When word reached Turnbull, he judged it to be part of a bigger plot, so he made a plan to head it off.

Turnbull began the Tuesday morning party room meeting talking about the national energy guarantee.

He gave his usual discursive address and then suddenly changed tack.

“Things can’t go on like this,” he told stunned colleagues, then blindsided them further by vacating the two leadership positions and announcing a ballot on the spot.

“People who were drinking coffee spat it out,” one MP says of the shock.

Party whip Nola Marino had been alerted and the ballot papers were ready.

MPs were furiously texting – some assumed they were texting journalists and some were. But Dutton’s and Morrison’s supporters were, it seems, also texting each other across the room.

Dutton stood against Turnbull, securing 35 votes to Turnbull’s 48.

Caught off guard and without time to lobby, Dutton’s supporters were jubilant at how well their candidate had done.

It was a stunningly high vote for a challenger from what looked like a standing start, and a diabolical miscalculation for the incumbent prime minister.

The difference of just 13 votes meant only seven MPs needed to switch for Turnbull to be out.

The size of Dutton’s vote guaranteed that far from being resolved, or even eased, the crisis only worsened for Turnbull. It shocked just about all involved – certainly both Turnbull and Dutton.

It appears the person least shocked may have been the then treasurer and now prime minister Scott Morrison.

After a week of disentangling what actually happened, some within both the Dutton and Turnbull camps have reached the view independently that the reason those first numbers for Dutton were so high had less to do with Dutton becoming prime minister than with installing Scott Morrison instead.

Supporters for both Dutton and Turnbull say they believe it was actually Morrison’s backers who secretly forced matters to a head, voting for Dutton in the first ballot to boost his numbers and generate a crisis for Turnbull, while intending all along for their man to prevail.

Although it was the actions of Dutton and then Turnbull that sparked the events of last week, sources in both camps have concluded that the outcome was likely engineered by Morrison’s supporters from the beginning.

One MP pointed to the five extra votes that were lodged in favour of the spill motion that were unaccounted for among Dutton’s supporters.

Turnbull’s supporters and those who did not want another leadership ballot voted against it on Friday morning. They numbered 40, but with 45 in favour, they lost.

In the leadership ballot that followed – after Julie Bishop was swept out with just 11 votes and not a single one from her Western Australian colleagues – Dutton secured 40 votes to Morrison’s 45.

Bishop’s betrayal by her WA colleagues – and many fellow moderates – left her so disillusioned that she would announce she was quitting as foreign minister two days later.

Asked at a news conference if she thought the Liberal Party would ever elect a popular female leader, the woman who consistently tops the polls as preferred leader said dryly: “When we find one, I’m sure we will.”

Back in the party room, what persuaded some MPs that a tricky, hidden power play was under way was the result in the threshold vote on whether to have the second ballot at all.

“The telling vote was the 40 to 45 [in favour of the spill],” an MP says.

“Assuming the Dutton vote was 40 [based on his result in the subsequent ballot], where did the other five come from? They were Morrison people who voted for the spill.”

Several sources also confirmed that New South Wales Liberal Party powerbroker and lobbyist Michael Photios, a supporter of Morrison’s, was instrumental in the manoeuvring during the week.

One person not linked to either camp says Photios was deeply involved. Multiple sources also confirm his business partner and former NSW Liberal Party president Nick Campbell helped, along with Morrison’s usual numbers man, Alex Hawke. Hawke did not return calls before time of press.

“This was not a ‘defend Malcolm’ exercise,” one Dutton backer said of Morrison’s group. “This was a ‘get Malcolm’ exercise. They came at him from both sides.”

Some who wanted Dutton as prime minister are bitter that his lieutenants – Victorian MP Michael Sukkar, South Australian Tony Pasin, ACT senator Zed Seselja and others – bungled the process, wrongly assumed they had the numbers and were played for mugs.

The Saturday Paper has been told that Sky News commentator Peta Credlin, who is former chief of staff to ex-prime minister Tony Abbott and was broadcasting from Canberra last week, was offering advice in the background.

Credlin has contacted the paper to strenuously deny this, calling it “an absolute lie”.

The Saturday Paper understands that even after the first vote on Tuesday, Dutton told close colleagues he was still inclined to wait and gather more support for a second challenge when parliament resumed in a fortnight.

But his numbers men persuaded him he needed to move fast – a move that would ultimately benefit Morrison.

Another MP, who is angry at what is now believed to have been a clever game of doublecross, says Morrison’s tacticians played “rope-a-dope” with the home affairs minister.

A spokesman for Prime Minister Morrison told The Saturday Paper: “The prime minister won’t be responding to unsubstantiated reports.”

Mathias Cormann’s public shift against Turnbull was instrumental in hastening the prime minister’s downfall.

Cormann visited Turnbull on Wednesday and told him his support in the party room had collapsed.

It was at this meeting that Turnbull is understood to have told him his switch was akin to giving in to terrorists.

Cormann is believed to have responded that he had no choice.

Others say Cormann did have a choice and it was the choice he made that finally tipped the balance. But Cormann has insisted privately that even after the first leadership ballot he was trying to bring Dutton and Turnbull together.

After his meeting with Cormann, Turnbull called a news conference, insisting both Cormann and Morrison accompany him.

There, he announced he was dumping the top-end tax cuts and reversing plans to scrap the welfare supplement that was originally compensation for the carbon tax that had since been repealed. If Turnbull lost his leadership, he would not let his successor get the benefit of announcing the policy change he had wanted all along.

He also ensured both men would be asked to pledge their loyalty to him – publicly – which they did. Morrison even put his arm around Turnbull as proof.

That night, Cormann went back to see Turnbull, accompanied by cabinet colleagues Mitch Fifield and Michaelia Cash – who Turnbull had defended throughout her own recent political difficulties. All withdrew their support.

Cormann’s public declaration on Thursday morning that Turnbull had lost majority support, made alongside Fifield and Cash, was what guaranteed a second ballot.

“It’s with great sadness and a heavy heart that we went to see the prime minister yesterday afternoon to advise him that, in our judgement, he no longer enjoyed the support of the majority of members in the Liberal Party party room, and that it was in the best interests of the Liberal Party to help manage an orderly transition to a new leader,” Cormann said.

“I did not want to be in this position. I have loyally supported Malcolm Turnbull since he was elected leader of the Liberal Party. I was wanting to continue to support Malcolm Turnbull for years to come as leader of the Liberal Party. But I can’t ignore reality.”

Turnbull had called a series of meetings the previous night, including with his treasurer, Scott Morrison.

Morrison and his supporters had made it known earlier in the week that he would not be a candidate if Turnbull was going to stand.

But Morrison was willing to position himself as an alternative to Dutton once Turnbull was out of the race.

On Thursday, Turnbull indicated he wouldn’t run if the numbers were against him, but gave colleagues mixed messages on whether he would change his mind. It seems Morrison was already making calls, offering himself as a better alternative than Dutton.

In order to become a candidate, Morrison needed Turnbull to concede defeat and not contest the leadership again. He wanted to take the leadership with clean hands, not burdened by having brought down a prime minister.

It is not clear exactly who persuaded Turnbull that he no longer controlled his own parliamentary party, but whoever did was wrong.

Turnbull decided that if the plotters could prove at least 43 MPs, of a possible 85, wanted a second leadership ballot, he would call a meeting for Friday at noon and hold a vote on whether there should be a second spill for the week. If most were in favour, he would step down.

Some of Turnbull’s supporters began drumming up support for Morrison.

“Malcolm believed that Scott was part of his Praetorian Guard,” one colleague says.

The delay, designed only to force the traitors to put names to their intentions, also gave Morrison extra time to lobby.

On Thursday afternoon, Julie Bishop indicated she would be a candidate. It’s understood she told colleagues she only did so once she was certain Turnbull would not run.

A series of encrypted WhatsApp messages leaked to the ABC’s Insiders program on Sunday revealed that moderate Liberals who might have been inclined to vote for Bishop were being urged to back Morrison instead.

The argument, put in a message from NSW Liberal Paul Fletcher, was that Cormann was “rumoured to be putting some WA votes behind Julie Bishop in round one”.

“Be aware that this is a ruse trying to get her ahead of Morrison so he drops out and his votes go to Dutton,” Fletcher wrote. “Despite our hearts tugging us to Julie, we need to vote with our heads for Scott in round one.”

That meant Bishop ran third and dropped out, leaving a contest between Morrison and Dutton.

The leaked messages also show Christopher Pyne saying he had warned Bishop. She has told others he didn’t.

What did not become clear until after Friday’s final vote – way too late for Turnbull – was that despite the 43 signatures, Dutton never had majority support.

In the end, Morrison won 45 to 40.

Morrison’s ministry was assembled within two days of his win, a fast turnaround for someone not expecting to become prime minister. It includes sacked former ministers Sussan Ley and Stuart Robert, both of whom are believed to have supported him.

They have been returned to the outer ministry despite having been demoted under Turnbull following controversies over their use of ministerial office and despite Morrison insisting the incoming leadership team of himself and Victorian Josh Frydenberg represent “a new generation”.

Cormann has lost part of his portfolio – the special minister of state dimension overseeing electoral issues and parliamentary expenses – to Morrison loyalist Alex Hawke.

Dutton’s junior henchmen are out.

A byelection is now expected in the prized Sydney seat of Wentworth as Malcolm Turnbull bows out of politics.

For the time being, Julie Bishop is staying in her own prized WA seat of Curtin. Close confidants say that’s to keep Attorney-General Christian Porter, whose own seat is very marginal, and Senator Cormann from trying to move in.

And Victorian Liberal MP Julia Banks, the only Liberal to win a seat from Labor at the 2016 election, announced this week that she won’t contest the next election – citing bullying, intimidation and harassment generally, and particularly through last week’s leadership turmoil.

Prime Minister Scott Morrison says he’ll have no truck with such thuggish behaviour.

“One of the things we are moving quickly to do is ensure we restore that strong culture in the Liberal Party and bring the party together and show the stability and unity that is necessary, that Australians are looking to me to provide,” he said.

Good luck with that.

This piece was modified on September 2, 2018, to include Peta Credlin's denial of involvement.