As Tory MPs gathered in parliament on Wednesday evening, just hours before a reshuffle that most believed would be intriguing rather than explosive, they gave a warm welcome to the opening speaker. A grinning Sajid Javid, whose position as chancellor had previously been publicly guaranteed by the prime minister, said a few warm words before introducing Andy Street, the West Midlands mayor who talked them through his plans. For those in the room with doubts about Javid’s future, his cameo reassured them that he would survive the imminent ministerial cull.

Despite the smile, however, Javid himself had become less confident in his position in the days leading up to Thursday’s reshuffle. He confided in friends that he feared his special advisers were being targeted by Downing St. A week of damaging media briefings about the forthcoming budget and relations between the Treasury and No 10 had raised fresh doubts. Those doubts were well founded: by late morning, he had gone.

Last night, Javid’s allies remained furious about Boris Johnson’s demand that Javid sack his advisers as part of a plan to combine the No 10 and No 11 team of special advisers, or “spads” – an inflammatory order that Javid felt compelled to refuse. However, they were clear on what was behind the surprise demand, which was presented as an afterthought by the prime minister at the end of a long and otherwise good-natured meeting with his now former chancellor.

“The hierarchy of the move would be: 1, power and process, 2, policy and 3, personality,” said one Javid ally. “It was predominantly about a frustration about the sheer power of the Treasury. It’s very difficult to do something about that, short of massive Whitehall reorganisation. The one lever they had was the spad universe. It was a change of institutional power via the backdoor. It wasn’t so much a joint team as a No 10 team.”

Both Javid’s friends and senior figures across Whitehall are now trying to decipher a bigger question posed by the No 10 power grab, which dominated the reshuffle: would it come to be seen as the high watermark of the influence of Dominic Cummings, the Vote Leave mastermind and senior adviser to Johnson? Or was it just an early skirmish in a much more ambitious attempt to sideline officials and departments, and centralise power inside Downing St?

To some Cummings allies, rearranging and controlling the spads across Whitehall is the easy part of what they hope is a more ambitious plan to shake up Whitehall. As one put it: “[Cummings] seems to focus on spads. For sure they are the most likely to leak, but not the biggest blocker – that’s civil servants. And he’s done nothing on that. He’ll now try with the civil service which is where the real fight starts.”

Facebook Twitter Pinterest New chancellor of the exchequer Rishi Sunak. Photograph: Neil Hall/EPA

As the reshuffle unfolded last week, Tory MPs were initially baffled by the survival of some figures. One minster was surprised and concerned to see their own secretary of state return, having concluded they would be fired – and believing their dismissal to be the right move.

However, taken as a whole, Tories saw that the reshuffle clearly reflected the wider Cummings agenda. John Whittingdale, a critic of the BBC, made a surprise return as culture minister. Chris Skidmore, the respected universities and science minister, was sacked – with the science brief taken out of the job description. It is a move that could give Cummings more space to push for his pet project – the creation of a British Advanced Research Projects Agency, which he believes could create ideas and projects with “world-changing potential”. Julian Smith, who had raised concerns about a no-deal Brexit on relations in Northern Ireland, was fired.

One Tory described Suella Braverman’s appointment as attorney general as a “blatant political appointment”. Braverman, like Cummings, is highly critical of what they believe is the politicisation of the judiciary, particularly in the wake of the Supreme Court’s ruling that Johnson’s attempt to prorogue parliament last year was unlawful. Meanwhile, Nus Ghani, a popular transport minister, was also sacked. She had been an enthusiastic supporter of Jeremy Hunt’s leadership campaign. “They want someone who will do what they’re told,” said a minister. “They’ve looked at difficult areas where they will need someone who is compliant.”

For all the attempts to compare the Cummings power grab with Alastair Campbell’s dominance at the peak of New Labour, Whitehall veterans say the more telling comparison is with Ted Heath, who handed huge power to his official, William Armstrong, at the expense of the Treasury and his chancellor, Anthony Barber. Armstrong eventually had a breakdown, in the wake of the dispute with miners over the imposition of a three-day week.

It was about frustration at the sheer power of the Treasury … a change of institutional power via the backdoor Sajid Javid ally

The frustration for Javid’s team was that while there had been early skirmishes over policy, they had not made the toughest decisions. The relationship between Javid and Johnson was strong. Javid invited just three MPs to his recent 50th birthday party. One was the prime minister, who sat on the top table. The attempt inside Downing St to talk Javid round was prolonged and genuine. First, members of Johnson’s staff attempted to change his mind, before a final one-on-one talk between prime minister and chancellor. Johnson is already said to have told senior Tories that he wants Javid back.

However, in the week before the reshuffle, Javid’s team became concerned. Briefings emerged in the media, which they believe were designed to unsettle the No10 and No11 relationship – some believe stories about a possible mansion tax were planted, to be used as evidence against Javid and his team. The emergence of the idea on the front page of a newspaper last weekend baffled those working on the budget. The story didn’t seem to serve any purpose, other than to poison the well between No10 and No11, and foment distrust. In reality, insiders say that there were figures inside Downing St interested in a mansion tax, but that there were also sympathisers in the Treasury. However, Javid was already against the idea.

There was also a briefing about a fallout between the prime minister’s partner Carrie Symonds and Cummings, suggesting that she was critical of his aggressive approach and argued against sacking Javid. The story cited “well-placed Treasury sources”, but Javid’s allies insist it did not come from them and they detect foul play. “It was dark arts,” said one friend.

Facebook Twitter Pinterest Boris Johnson – demanded that Javid sack his advisers. Photograph: Matt Dunham/PA

Treasury sources admit that a mistake was made in its handling of HS2, in which Javid’s backing for the project was announced before No10 had made an official decision to go ahead with the project. Other than that, there was little ammunition to throw at Javid. Indeed, when Javid asked the prime minister why his team should be dismissed, Johnson was unable to offer an argument.

So what’s next for Javid’s replacement? Rishi Sunak, the highly-rated but untested new chancellor, is said to be spending the next week thinking things through, though it is still expected that the Budget will go ahead around 11 March. One consequence of the fallout, however, is that Sunak has been placed in the position of taking a role seen as too subservient for his predecessor. “He’s in an exceptionally difficult position,” said one senior MP. “He needs to have some distance [around the budget]. Otherwise, it’ll look like a farce.”

The big question is whether Sunak sticks to Javid’s fiscal rule, which promises to balance the books on day-to-day spending by the middle of the parliament. It is this rule that has restricted No10’s hopes of ploughing money into its “levelling up” agenda. The issue of the level of spending is now the coming battle within the Tory party.

“You can’t just spend, spend, spend,” said one concerned minister. “Sooner or later, the inherent contradiction of saying ‘the Labour Party spend too much’ will be pointed out if we also decide to spend too much. I think Cummings has overreached himself and there will be grave concern, privately. It’s all right now, with no Labour opposition and no clarity on where the economy is going.

“But I say to my Labour colleagues, they had more seats than us in 2005 and five years later, we were in government.”