Jeremy Hunt has been accused of prolonging the junior doctors’ dispute unnecessarily for three months after it could have been settled by putting personal “pride” before a resolution.

Labour’s Heidi Alexander claimed in the Commons that the health secretary had missed an opportunity to settle the bitter row by displaying a damaging “computer says no” attitude to talks.

Hunt and Alexander, the shadow health secretary, traded verbal blows during a House of Commons debate on Thursday on the new deal announced on Wednesday, which both Hunt and the British Medical Association (BMA) hope will end the nine-month dispute.

“What is now clear, if it wasn’t already, is that a negotiated agreement was possible all along. So I have to ask you, why couldn’t this deal have been struck in February? Why did you allow your pride back then to come before sensible compromise and constructive talks?” Alexander said.

“When you stand up you might try to blame the BMA for the negotiations breaking down, but you failed to say what options you were prepared to consider in order to ensure that the junior doctors who work the most unsociable hours are fairly rewarded. It was a ‘computer says no’ attitude and that’s no way to run the NHS.”

Alexander said Hunt had ignored her suggestion, made on 7 February, that he make further concessions on the key issue of what hours junior doctor should be expected to work on Saturdays and their pay for doing so as a way of reaching a negotiated settlement.

Seven of the eight days of strikes by junior doctors in England happened after that, which between them involved the cancellation of more than 30,000 planned operations and more than 100,000 outpatient appointments. Four days after Alexander’s letter, Hunt told MPs that talks had failed because of the BMA’s refusal to discuss Saturday working and that he was imposing the contract that had prompted so much anger among junior doctors.

“Why did he then insist upon trying to bulldoze an imposed contract through when virtually everyone told him not to and the consequences of doing so were obvious for all to see – protracted industrial action, destroyed morale and a complete breakdown in trust?” she said.

But Hunt rejected her claims. He said the BMA had spent “years” refusing to discuss Saturday becoming part of a junior doctor’s normal working week, though he praised it for “bravely” changing its stance during the negotiations that led to Wednesday’s potential settlement.

And he criticised Alexander for refusing to say categorically if she supported the new agreement, and insisted he had shown leadership by facing down the BMA.

Junior doctors on strike at North Middlesex hospital in London. Photograph: Dinendra Haria/Rex/Shutterstock

It was a matter of “great regret” that junior doctors had staged eight days of walkouts since January, which included the first total withdrawal of medical cover in NHS history, even in areas of emergency care such as A&E and intensive care, for two days last month.

“Taken together, these changes show both the government’s commitment to safe care for patients and the value we attach to the role of junior doctors,” Hunt said.

“Whilst they do not remove every bugbear or frustration, they will significantly improve flexibility and work-life balance for doctors – leading, we hope, to improved retention rates, higher morale and better care for patients.”

Earlier Hunt admitted he had “lessons to learn” from his protracted dispute with England’s 55,000 junior doctors over plans to overhaul their contracts and reorganise NHS services to usher in a fuller seven-day service in hospitals.

Speaking on the Today programme on BBC Radio 4, Hunt insisted the government had secured its “red lines” for delivering its commitment to a seven-day health service by driving down the cost of employing doctors over the weekend.

But he added: “I don’t think you can go through what we have been through for the last 10 months and say that everyone hasn’t got lessons to learn, including the health secretary.

“I don’t say I was responsible for the industrial action because I think that was a decision taken by the BMA and initially caused by the fact that at the time there was not willingness to engage with the big issues that we needed to resolve to deliver a seven-day NHS.

“What I do say is we have come to appreciate that there was a lot of anger, a lot of frustration felt by junior doctors about things that extended well beyond their contract.”