SAN DIEGO — An immigrant who had been shielded from deportation but was sent back to Mexico has dropped his lawsuit against the Trump administration.

A federal judge in San Diego on Thursday agreed to dismiss the case filed by Juan Manuel Montes.

The suit was taxing for the 23-year-old, who is now living in Mexico, and he asked to drop it. But he stands by the claim that he was wrongly deported, said Marielena Hincapie, executive director of the National Immigration Law Center, which represented Montes.

“His decision to voluntarily dismiss his case does not change that,” she said.

The Department of Justice declined to comment on the case.

Montes’ lawyers say he was the first-known participant in the five-year-old Deferred Action for Childhood Arrivals program to be deported under President Donald Trump.

The program — which Trump announced last month he was ending — gave work permits and deportation protection to nearly 800,000 immigrants in the country illegally who were brought here as children.

Montes, who came to the United States when he was 9, has a cognitive disability that likely stems from a childhood brain injury, according to his lawyers.

Montes claimed that he was wrongly expelled in February from the United States, but the administration said he left the country voluntarily, causing him to lose his protected status under the program.

Montes said he finished dinner with a friend and was seeking a ride home in the California border town of Calexico when a Border Patrol agent stopped him.

When Montes failed to produce identification, he says agents questioned him and drove him after midnight to the border with orders to walk into neighboring Mexicali, Mexico.

Both sides agree on what happened next: Montes tried to return to the United States the next night by jumping the border fence in Calexico, was caught by Border Patrol agents and deported.

The Department of Homeland Security has said it has no record that authorities deported Montes two nights earlier and insists he crossed into Mexico voluntarily, violating a provision of the program that requires advanced permission to leave the country.