When New York City Mayor Bill de Blasio visited El Paso, Texas last month, he crossed a part of the U.S.-Mexico border on foot. The U.S. Customs and Border Protection is now alleging that he did so illegally.

The Associated Press obtained a letter from Aaron Hull, the chief patrol agent for the Border Patrol’s El Paso Sector, to New York Police Department Commissioner James O’Neill detailing how De Blasio potentially violated immigration law.

De Blasio went to a holding facility for immigrant children but was denied entry. He then went to Mexico and crossed into the U.S. to get a view of the facility. The New York Police Department runs de Blasio’s security detail. According to the letter, a uniformed Border Patrol agent noticed a group on the Rio Grande River flood plain south of the Tornillo, Texas, Port of Entry, taking photos of the holding facility. The agent asked if anyone from Border Patrol or public affairs was there to authorize their presence. A New York Police Department inspector said no, according to the letter, and when the agent asked the group how they arrived, they pointed to Mexico. The agent told them they’d crossed the border illegally and asked them to remain there while he got a supervisor and took them to an official crossing for an inspection per federal law, according to the letter. But the group disregarded the order and drove back to Mexico, according to the letter.

De Blasio's office is denying the allegations.

“The mayor crossed the border with the direct approval and under the supervision of the border patrol supervisor at this port of entry,” De Blasio spokesman Eric Phillips said in an email Tuesday to the AP. “Any suggestion otherwise is a flat-out lie and an obvious attempt by someone to attack the Mayor because of his advocacy for families being ripped apart at the border by the Trump Administration.”

The situation is made more comical by the fact that De Blasio has been part of the liberal resistance to President Trump's strict immigration policy. He has been especially opposed to Immigration and Customs Enforcement, telling New York City schools last year to avoid complying with the agents if they show up at their door.

Unless they obtain warrants, “ICE agents will not be wandering the halls of a school,” the mayor pledged.

He upped the rhetoric last month, accusing the agency of becoming a "punitive, negative tool for division." Its time, he said, has come and gone.

De Blasio was down at the border last month to protest Trump's zero-tolerance policy of separating illegal immigrant families at the border. The president recently signed an executive order to keep families together, and a federal judge has ordered the administration to reunite children already separated from their parents to be reunited by the end of July. The White House missed the first deadline and is asking for an extension.