Amal Clooney has quit her role as the UK's envoy on press freedom "in dismay" at the government's willingness to break international law over Brexit.
The human rights lawyer said it was "lamentable" for Boris Johnson to be contemplating overriding the Brexit agreement he signed last year.
She could not tell others to honour legal obligations when the UK "declares it does not intend to do so itself".
The UK PM says he does not want to use the powers in the Internal Market Bill.
But he says the legislation is necessary to give the government the power to protect the UK and, particularly, Northern Ireland if trade talks fail and the EU acts "unreasonably".
In her resignation letter, Mrs Clooney, who is married to Hollywood actor George Clooney, said she had accepted the job last year because of the UK's historic role in upholding the international legal order.
But she said the government's attempts to pass the Internal Market Bill, which passed its first hurdle in the Commons last week, made her position "untenable".
She said she had decided to quit after speaking to foreign secretary Dominic Raab and getting "no assurance that any change of position is imminent".
She added: "It is lamentable for the UK to be speaking of its intention to violate an international treaty signed by the prime minister less than a year ago.
"It has become untenable for me, as Special Envoy, to urge other states to respect and enforce international obligations while the UK declares that it does not intend to do so itself."
Mrs Clooney was appointed by Jeremy Hunt, Mr Raab's predecessor, during the final months of Theresa May's government and continued in the role after Boris Johnson took over in No 10.
She was the deputy chair of the high-level panel of legal experts which works with the UK and Canadian governments on their campaign to promote media freedom around the world.
Labour leader Sir Keir Starmer, who used to practice in the same barristers' chambers as Mrs Clooney, said she had taken the right decision.
"I know Amal and she is a first class lawyer. I'm not surprised that she has quit because, like others, she's concluded that there is a conflict between a breach of international law - which the government seems intent on - and our reputation as a country in the world that abides by the rule of law," he said.
Her resignation adds to a growing list of senior legal figures who have quit their roles in disquiet at the government's position.
Lord Keen resigned as Advocate General for Scotland on Wednesday, saying he found it "increasingly difficult to reconcile" his obligations as a lawyer with provisions in the legislation.
The government's most senior legal adviser - Sir Jonathan Jones, permanent secretary to the government legal department - had already resigned, as had the UK's envoy for the protection of religious freedoms, Tory MP Rehman Chishti.
The EU has demanded the government removes sections of the Bill which would give the UK the power to override agreements on the movement of goods between Northern Ireland and Britain and subsidies for NI companies.
Northern Ireland Secretary Brandon Lewis has admitted the powers, if they were ever used, would break the UK's treaty obligations under international law in a "specific and limited" way.
The prime minister has sought to quell a potential rebellion by Tory MPs next week by promising critics that the Commons will get a specific vote on the powers before the government can use them.
But former Conservative leader Lord Howard has said the PM needs to go further, saying it was a matter of principle and he doubted whether the Lords would back the bill as it stands.