The attorney general’s office said previous advice saying the opposite had changed because the agreement between the UK and EU is causing social unrest.
This means there could be new legislation scrapping checks on goods going from Britain to Northern Ireland.
The UK and EU are set to hold talks later to tackle the escalating dispute.
The new legal advice given to Attorney General Suella Braverman could allow the UK to make good on its repeated threats to scrap contentious parts of the agreement made with Brussels called the Northern Ireland Protocol.
Designed to avoid the need for a hard border with the Republic of Ireland, the deal came into force in 2021 and imposed checks on goods moving between Britain and Northern Ireland – angering unionists, who claimed it had made a border in the Irish Sea instead.
The Times, which first reported the change in legal advice, said the attorney general argued that signs of violence – such as a hoax bomb attack targeting Irish Foreign Minister Simon Coveney in March – justified the UK overriding the deal to keep the peace.
Prime Minister Boris Johnson said on Wednesday that “the most important agreement is the 25-year-old Belfast Good Friday Agreement”, which set up a cross-community power-sharing government as a way of ending decades of violence.
He said the Northern Ireland protocol failed to command cross-community support and “we need to sort it out”.
But Mr Johnson also said there should not be any need for “drama” over making changes to the deal.
The process of changing the trade arrangements is likely to take more than a year, with the House of Lords expected to try to block and delay the government’s legislation.
A stand-off which emerged out of the Northern Ireland Assembly election has increased the urgency, however.
The Democratic Unionist Party – which came second in the poll after Sinn Féin and backs continuing the union between Great Britain and Northern Ireland – is refusing to nominate ministers to help form a new executive until its issues with the trade protocol are tackled.
The election established a majority for assembly members who support the protocol, with Republican Sinn Féin as the largest party for the first time.
But under the rules of the Northern Ireland Assembly, Sinn Féin cannot nominate a first minister without a unionist deputy minister.
Foreign Secretary Liz Truss, who has said she would not shy away from “taking action to stabilise the situation in Northern Ireland”, is due to hold talks with the vice-president of the European Commission on Thursday morning.
She is expected to tell Maros Sefcovic in a call that the dispute cannot be allowed to drag on.
The EU proposed changes to the protocol in October, focused on reducing inspections of food products in particular, but Ms Truss has rejected this plan.
Because of grace periods, the protocol is not yet being fully implemented, so the UK has argued that the changes being proposed would actually increase checks and controls, leading to “everyday items disappearing from the shelves”.
Mr Sefcovic has previously called on the UK to “dial down the rhetoric” and to “be honest” about what it committed to when it signed up to the protocol.