(Reuters) - The U.S. Justice Department on Monday said a criminal conviction against ex-Arizona Sheriff Joe Arpaio should be dismissed as moot in the wake of a controversial pardon from President Donald Trump, according to a court filing.

However several legal groups, including one staffed by lawyers who worked for President Barack Obama’s administration, urged an Arizona federal judge to deem the pardon an unconstitutional overreach of executive authority.

Trump, a Republican who has promised to build a wall along the U.S. border with Mexico, has praised Arpaio’s crackdown on undocumented immigrants in Arizona’s Maricopa County which drew condemnation from civil rights groups.

Arpaio was convicted in July of willfully violating a 2011 injunction barring his officers from stopping and detaining Latino motorists solely on suspicion that they were in the country illegally. He had not yet been sentenced when Trump issued the pardon last month.

Arpaio asked U.S. District Judge Susan Bolton in Arizona to vacate the verdict and all other orders in the case. The Justice Department on Monday said his request was valid.

“The presidential pardon removes any punitive consequences that would otherwise flow from [Arpaio’s] non-final conviction and therefore renders the case moot,” it wrote in a court filing.

The Protect Democracy Project, an advocacy group that includes the Obama administration lawyers, filed a separate brief urging Bolton to first decide whether the pardon was constitutional before dismissing the case.

It was joined by the Coalition to Preserve Protect and Defend, a legal group consisting largely of government attorneys, and other legal advocacy organizations. Trump’s pardon will remove the ability of the courts to enforce its own orders, the coalition argued.

“The result would be an executive branch freed from the judicial scrutiny required to assure compliance with the dictates of the Bill of Rights and other constitutional safeguards,” the group wrote.

Arpaio campaigned for Trump in 2016 and investigated unfounded claims that Obama was not born in the United States, a falsehood that Trump also espoused for years.

“Sheriff Joe is a patriot. Sheriff Joe loves our country. Sheriff Joe protected our borders,” Trump said last month. “So I stand by my pardon of Sheriff Joe, and I think the people of Arizona, who really know him best, would agree with me.”