WASHINGTON (CBSNewYork/AP) — Mayor Bill de Blasio and his security detail violated both Mexican and U.S. immigration laws by crossing the border on foot during a visit near El Paso, Texas, U.S. Customs and Border Protection alleges in a letter obtained by The Associated Press.

The mayor’s office flatly denied the allegation.

De Blasio, a fierce critic of the Trump administration’s immigration policies, went to the Texas border with about 20 other mayors from around the country on June 21, the day after President Donald Trump signed an order stopping family separations at the border.

“Every country needs reasonable law enforcement on their borders. ICE is not reasonable law enforcement. ICE is broken, it’s divisive and it should be abolished,” the mayor tweeted last month.

More than 2,300 families were separated as a result of the administration’s zero-tolerance policy, which criminally prosecutes anyone caught crossing illegally. The mayors said Trump had failed to address a humanitarian crisis of his own making.

debalsioborder 980530968 Feds Say Mayor De Blasio Crossed U.S. Mexico Border Illegally

Mayor Bill de Blasio stops at a gate after being told he could not cross through the gate to the tent facility setup at the Tornillo-Guadalupe Port of Entry on June 21, 2018 in Fabens, Texas. (Photo by Joe Raedle/Getty Images)

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.

However, de Blasio said Wednesday the border agents let him cross and called the charges “absolutely ridiculous.”

“We were told where the border line was, and we respected it. We came back the exact same way, both times showed passports,” he said. “At no point did we disregard any instructions from federal authorities, period.”

De Blasio spokesman Eric Phillips said the group did nothing illegal and had approval to be there.

“The mayor crossed the border with the direct approval and under the supervision of the border patrol supervisor at this port of entry,” Phillips said in an email Tuesday night 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.”

Phillips had posted tweets of the mayor’s visit on June 21.

Security expert Manny Gomez, a former FBI agent and NYPD officer, told CBS2’s Political Reporter Marcia Kramer that Border Patrol agents wouldn’t have written the letter if they didn’t have a legitimate concern.

“I doubt that the Border Patrol would make something up that isn’t true,” he said.

Gomez also raised another issue about the mayor putting his security detail in a tough spot.

“It’s not to the NYPD to determine which is the border. The NYPD’s jurisdiction is obviously within the confines of the five boroughs of the city of New York,” he said. “It shouldn’t be up to them to discern and educate the mayor of New York as to where the border between the U.S. and Mexico is.”

A spokesperson for the Border Protection had no comment.

The letter was sent June 25 by Aaron Hull, the chief patrol agent for the Border Patrol’s El Paso Sector to New York Police Department Commissioner James O’Neill.

The mayor blamed the letter on politics and his disagreements with the Trump administration.

An NYPD spokesperson told Kramer that O’Neill reviewed the letter and will not take action against any of the NYPD officers involved.