Michael Gove has defended the government’s plan to override parts of its own Brexit deal with the EU, claiming the internal market bill was necessary to protect the territorial integrity of the UK.

He also insisted that the government was acting “within the rule of law” and was behaving in a “constructive and pragmatic” way, despite the Northern Ireland secretary admitting the new legislation would breach international law.

The Cabinet Office minister, who was doing the rounds of TV and radio programmes on Saturday morning, told BBC Breakfast the EU could put the integrity of the UK at threat without the controversial legislation the government is trying to push through in the face of outrage even within the Tory party.

“We’re doing our part – generously – to help protect the EU’s own single market, but we’re clear that what we can’t have, even as we’re doing all that, is the EU disrupting and putting at threat the integrity of the United Kingdom,” Gove said.

“These steps are a safety net, they’re a long-stop in the event – which I don’t believe will come about but we do need to be ready for – that the EU follow through on what some have said they might do, which is in effect to separate Northern Ireland from the rest of the United Kingdom.”

Gove’s comments echoed Boris Johnson, who in an article in the Telegraph on Saturday wrote that legislation to override parts of his Brexit deal is needed to end EU threats to install a “blockade” in the Irish Sea.

The prime minister said Brussels could “carve up our country” and “seriously endanger peace and stability” in Northern Ireland if Conservative MPs rebel to block the internal market bill.

On BBC Radio 4’s Today programme, Gove was asked to explain what had changed for the government to believe it needs to change its own withdrawal bill.

The presenter Mishal Husain suggested there were only two explanations: either the government hadn’t thought the original withdrawal bill through, or had glossed over it because they wanted to get Brexit done.

Gove said it was neither. “These are not simple matters. There are clear and important principles here. We voted to leave the European Union, we voted as one United Kingdom. We’re introducing legislation to make sure that our United Kingdom remains strong, united and governed under the rule of law, but it is also the case that if we look at the detail of how we implement the protocol, I don’t think anyone would say that this was simplistic stuff.”

He said the government was dealing with the issues in a “constructive and pragmatic spirit”.

“That’s why we’re spending money. It’s why we’re investing in order to make sure that the protocol works, because we’re committed to the withdrawal agreement and the protocol. But what we are also committed to is the integrity of the whole UK.”

Asked later, on Times Radio, if the dispute over Brexit this week had undermined the UK’s reputation, Gove said: “I don’t think so. I think people recognise that in a negotiation like the one that we’re having as we leave the European Union, there are inevitably changes in the way in which we interact with our neighbours.