A little over four months ago, the Tory MEP and hardline Eurosceptic Daniel Hannan concluded an article for the Washington Examiner website with the following observations about Theresa May. “The new prime minister, in short, has all the advantages that Thatcher lacked: a united party, a pitiful and shredded opposition, stratospheric personal approval ratings, a growing economy.”

She was reaping the benefits, Hannan believed, of a set of political circumstances more favourable than any British prime minister had enjoyed in decades. He was writing just days after May had called a snap general election for 8 June – one in which the MEP was sure she would “sweep up dozens of Labour-held constituencies”.

Three days later the Sun published the results of an opinion poll under a headline that expressed the same sentiments. “Theresa May is seen as the best prime minister in nearly 40 years – polling even higher than Margaret Thatcher. Whopping 61% of British voters back May as most capable PM.” The anti-EU forces in the Tory party and the media were relishing what they saw as the invincibility of a prime minister committed, totally, to their vision of a hard Brexit.

Today May is not the seemingly all-powerful figure of early spring but a prime minister most in her own party see as a hugely diminished figure, on borrowed time, and gradually losing her grip on power. It is a measure of May’s meteoric decline since her general election gamble so spectacularly backfired that last week, on a trip to Japan, the biggest story that emerged was not about the post-Brexit trade deal she wants to strike with the Japanese but the dimming chances of her limping on at No 10 for much longer.

Asked by British journalists on the trip if she would step down before the next election, due in 2022, May replied “I’m not a quitter”, adding when pressed: “Yes, I’m in this for the long term.”

Back home, Tory MPs and peers issued collective gasps of disbelief and, in some quarters, horror. Two of her sharpest critics, the former ministers Anna Soubry and Nicky Morgan, were enjoying a meal together when the news filtered through. They did not dwell long on the subject because both regarded the idea of her leading the party into another election – having squandered a 20-point poll lead in the last one – as too absurd to merit much serious discussion.

Several senior Tories, including the former deputy prime minister Lord Heseltine and the ex-party chairman Grant Shapps, went public with savage denunciations. Heseltine was the most scathing. “The long term is the difficult one for Theresa May because I don’t think she’s got a long term.” Bob Neill, the pro-Remain Tory MP for Bromley and Chislehurst, took a less strident line, but quietly and politely questioned the PM’s longevity. “I don’t think that in all honesty she could have answered the question in any other way really,” he told the Observer, before adding: “But going forward I think, and I believe many colleagues agree, that we need a fresh approach as we head towards the next election.”

If she believes what she said she is deluded. Brexit is not going to turn out well. After that, I think the penny will drop. Former minister

While May received some important backing – including from Graham Brady, the chairman of the 1922 committee of Tory backbenchers, privately most Tory MPs now believe the prime minister’s days are numbered. Another former minister said: “I think that if she believes what she said, which I hope she doesn’t, that she is just deluded. She can try to get us through Brexit, but that is not going to turn out well. After that, I think the penny will drop. It has to drop.”

There is already dark talk among some Conservative MPs of letters being fired off to Brady expressing no confidence in May. If 15% of the 316 Conservative MPs were to send in letters saying enough was enough, a leadership contest would have to take place.

This week MPs return to Westminster after the summer break. Then on Thursday the European Union (withdrawal) bill begins its second reading in the Commons. Day by day over the coming months, as the bill grinds its way through the Commons and Lords, May’s chances of clinging to power will be measured against the progress, or otherwise, that this momentous piece of legislation makes towards the statute book. Judging by the glacial pace of Brexit negotiations with Brussels, the bill will travel at a slow stagger.

The Tory whips, knowing that their party lacks a working Commons majority and that they must rely on unionist votes, are already mounting an arm-twisting operation that Conservative MPs report is every bit as ruthless as that run by John Major’s enforcers in the early 1990s during the turbulent passage of the Maastricht treaty. David Davis – now May’s Brexit secretary – was in that notoriously bullying whips’ office, an irony not lost on Tory MPs.

David Davis was a member of the bullying whips’ office that forced through the Maastricht treaty in the early 1990s. Photograph: Jacquelyn Martin/AP

Even before the summer break, the government’s parliamentary challenge over Brexit looked tough enough. Tory MPs are split between minorities of hardline soft Brexiters in one corner and staunch, uncompromising Brexit ultras in another. In the middle is a large majority of pragmatic soft Brexiters, many of whom voted Remain in the referendum but now insist the result must be honoured. A rebellion by as few as two dozen Tories on any measure in the bill could lead to a defeat for May, and further weaken her tenuous grip on power.

The dramatic shift last weekend in Labour’s position on Brexit – to one where it backs membership of the single market and customs union during a transition period after Brexit, and possibly for good – puts May in far greater danger than before. It raises the real prospect that a pro-single market amendment tabled by a Tory rebel could attract enough Labour, SNP, Lib Dem and other support to bring about a government defeat. Anti-hard Brexit Tory rebels will not back a Labour amendment, but Labour could very well back one from a Tory, if it is in line with its new policy.

So panicked are the Conservative whips that they are telling their MPs that if they cause trouble and put down amendments it will amount to treachery, and be viewed as plotting with Jeremy Corbyn. For some potential rebels such as Soubry – who insist it is their duty to put their beliefs above their party on such important issues – these warnings are like a red rag to a bull. This weekend May is appealing to her MPs to back the bill, while accepting their right to contribute to the debate and process of scrutiny.

“Now it is time for parliament to play its part,” she says. “The bill delivers the result of the referendum by ending the direct role of the EU in UK law, but it is also the single most important step we can take to prevent a cliff-edge, because it transfers laws and provides legal continuity.

“We have made time for proper parliamentary scrutiny of Brexit legislation and welcome the contributions of MPs from across the House. But for us to grasp the great prize ahead of us, that contribution must fit with our shared aim: to help Britain make a success of Brexit and become that great global country we know we can be.”

The bill’s second reading this week and next will provoke heated argument and passionate speeches from all sides, and there will be rows over how much time is allowed for debate and amendments, as well as demands from Labour for a string of changes. It will be a taster of far bigger autumn battles to come. May’s attention will turn after next week to the Tory gathering in Manchester, where she will need to make the speech of her life to rally a bruised and bitterly divided party behind her.

Then, when parliament gathers again in early October, the real confrontations will come at the bill’s committee stage. MPs of all parties will put down dozens of amendments. It could take just one from a rebel Tory – backed by other parties – to hole May and her premiership below the waterline.

“That is when we will show our hands,” said one former Tory minister who vowed not to be deterred by anything that the whips might throw at him in the meantime. “That is when the fun will begin.”