It is understood Sir Jonathan Jones, permanent secretary to the Government Legal Department, was unhappy with a new bill to be unveiled on Wednesday.
He has resigned and will leave his post before his five-year term was due to end next April.
He is the sixth senior civil servant to announce his exit this year.
BBC political editor Laura Kuenssberg said Sir Jonathan believed the plans went too far in breaching the government’s obligations under international law.
A spokesman for the Attorney General’s Office confirmed Sir Jonathan had resigned but did not comment further.
The Financial Times, which first reported the story, linked his departure to “suggestions that Boris Johnson is trying to row back on parts of last year’s Brexit deal relating to Northern Ireland”.
To read the full article, please click here.