In 2010, with the Liberal party in New South Wales within striking distance of forming government for the first time in 16 years, the then opposition leader, Barry O’Farrell, helped broker a peace deal between the party’s warring factions.

The handshake deal between the moderate powerbroker Michael Photios and rightwing standard-bearer David Clarke settled the party’s preselections going into the 2011 election, and allowed the Liberals to sit back and watch as Labor imploded.

Part of that “peace in our time” deal, a senior Liberal party source told Guardian Australia this week, was a moratorium on any change to abortion law in the state.

“The agreement was that after 2011 the moderates would not move on it, and nor would David [Clarke] and the guys on the right who wanted to crack down further,” the source said. “We’d just stick with the 1971 [common law] decision and in effect freeze the issue.”

Barnaby Joyce was criticised by the deputy premier, John Barilaro, after he sought to intervene in the NSW abortion debate. Photograph: Mike Bowers/The Guardian

The handshake deal remained mostly in place through the government’s first two terms. It’s part of the reason why when Greens upper house MP Mehreen Faruqi moved a bill in the upper house to remove abortion from the Crimes Act in 2017, even government MPs in favour of reform helped to vote it down.

But nine years later the peace deal has been dramatically thrown out, and the Coalition government is tearing itself apart over a bill to finally decriminalise abortion in the state.

Ministers are in open revolt, MPs are threatening to quit and, five months after she led the Coalition to an unlikely third term in majority government, the premier, Gladys Berejiklian, is being described in newspaper columns as “embattled”.

Based on legislation passed in Queensland last year and co-sponsored by 15 MPs from across the political divide, the Reproductive Healthcare Reform bill removes abortion from the state’s 119-year-old Crimes Act and creates a standalone healthcare act to regulate the procedure.

It allows for terminations up to 22 weeks and, after that, with the approval of two doctors. Berejiklian, the health minister, Brad Hazzard, and the local government minister, Shelley Hancock, are among its supporters in the ministry.

But after easily passing the lower house 59 votes to 31 two weeks ago, Berejiklian this week caved to pressure from opponents of abortion reform and delayed a final vote on the bill in the upper house by three weeks.

It came after a concerted campaign by reform opponents to derail the bill. This week the anti-abortion former minister for women Tanya Davies said the bill had caused a “crisis of government”. Davies and fellow reform opponent Kevin Conolly have refused to rule out moving to the crossbench over the issue.

Protesters outside NSW parliament rally in favour of legalising abortion. Photograph: Richard Milnes/REX/Shutterstock

Anthony Roberts, the counter-terrorism minister, the police minister, David Elliott, the finance minister, Damien Tudehope, and the backbencher Matthew Mason-Cox have also criticised the premier’s handling of the bill.

“I’m very concerned – and I’ve raised it with the premier directly – that we are undermining our ability as a government to prosecute our agenda with what we’ve done with this bill,” Mason-Cox said at a press conference this week.

On the other side of the Coalition ledger, the bill has exposed divisions between the former federal Nationals leader Barnaby Joyce and his state counterparts.

Joyce was criticised by the deputy premier, John Barilaro, after he sought to intervene in the debate by recording a series of robocalls claiming the bill would “legalise abortion for any reason right up until the day of birth” and addressing an anti-abortion protest outside of the state parliament.

She’s pedantic and controlling ... and everyone hates her staff. NSW Liberal source on Gladys Berejiklian

The Nationals MP Trevor Khan is one of the bill’s architects, and the party’s support will be key to it passing next month. Sources within the party told Guardian Australia this week that Joyce’s vocal opposition to the bill has only hardened their resolve to support it. They even discussed his expulsion from the party at a meeting this week.

Amid all the noise, that the bill easily passed its second reading in the upper house 26 votes to 15 this week hardly seems to matter. The bill’s lead sponsor, the independent Sydney MP Alex Greenwich, said he was “disappointed” with the delay but the bill’s supporters remain confident it will pass.

“But the upper house has their processes and they have now provided a pathway and time for a final vote,” Greenwich said. “This will allow time for some of the concerning amendments to be further scrutinised.”

But what is the right actually hoping for? How much of it is about a bill to remove abortion from the state’s criminal code, and how much of it is about something else?

Opponents of reform such as Davies and Connolly are true believers. Davies, in particular, has been pushing for amendments to bill including provisions to ban so-called gender or sex selection. During the lower-house debate she unsuccessfully sought to include an amendment stating that terminations not “be used for gender selection”.

Davies relied on a 2018 study from La Trobe University that found that while the ratio of boys and girls born in Victoria was close to natural rates of 105 boys to every 100 girls, there were higher rates of boys born to mothers who had migrated from China and India.

Gladys Berejiklian was described as ‘terrible at communicating big strategies to cabinet’. Photograph: Joel Carrett/AAP

But during a review of the legislation last week, a number of expert medical, legal and women’s groups said there was no evidence the practice was an issue in NSW and this week one of the report’s co-authors told the New Daily the study’s findings had been “misrepresented”.

For others on the right, though, the fight is about something else: Berejiklian.

“It’s not really about this bill, this bill is just a symptom of a bigger problem,” one figure from the party’s right told Guardian Australia this week.

“Right now the tensions are really being caused by her leadership style. She’s pedantic and controlling, the whole government is centralised out of her office and everyone hates her staff. And she’s terrible at communicating big strategies to cabinet so most of them have no idea what’s going on.”

While the premier isn’t in danger of a challenge, there is a sense that the groundwork is being laid.

If that seems unlikely – or even ludicrous – given it’s been just five months since Berejiklian returned the government for a third term against expectations, consider this.

“Some people might say that,” the right-faction source said. “Others would say it’s the perfect time to be thinking about it. If you do it now, you’ve got three years of clear air.”