Theresa May. | John MacDougall/AFP via Getty Images Ex-British legal chief: May’s red line on ECJ ‘foolish’ ‘We will have the ECJ in all but name,’ says former government senior legal official.

The U.K. cannot have its cake and eat it when it comes to the rule of law after Brexit, a senior British legal expert warned, calling Theresa May's red line on the European Court of Justice "foolish."

The British government says it wants the most frictionless trade possible with the EU after Brexit, but no longer wants to be under the jurisdiction of the EU's highest court.

But "if the U.K. is to be part of something close enough to a customs union or the single market to remove the need for hard borders, it will only work if the rules are identical to the EU’s own internal rules," Paul Jenkins, the government’s most senior legal official for eight years until 2014, said in the Observer.

Jenkins also warned there must be "consistent policing of those rules."

"If Theresa May’s red line means we cannot be tied to the ECJ, the Brexit treaty will need to provide a parallel policing system. So, never mind Theresa May’s foolish red line; we will have the ECJ in all but name."

The British government will this week release its plan for how British legislation would take precedence after the country leaves the EU, detailing the role of the ECJ in a post-Brexit world, one in a series of new position papers ahead of the next round of Brexit talks in late August.