A panel of the U.S. Court of Appeals for the Second Circuit on Tuesday partially revived a lawsuit against the New York City and federal governments by a man born in Brooklyn who was held for four days in a Manhattan jail on a faulty federal immigration detainer.

A three-judge panel of the U.S. Court of Appeals for the Second Circuit said the lawsuit from Luis Hernandez, a 45-year-old American citizen, had supported claims that the federal officer who issued the notice following his arrest in September 2013 had lacked probable cause to do so.

According to the ruling, the lawsuit plausibly alleged that even a "rudimentary inquiry" into Hernandez' citizenship and identity by the Department of Homeland Security or city officials would have revealed that he was not the ʺLuis Enrique Hernandez‐Martinez" that Immigration and Customs Enforcement had claimed was subject to a removal order.

Hernandez sued the city and federal government for money damages in 2016, claiming false arrest and imprisonment and that his rights had been violated under the New York Constitution. Hernandez, who was arrested in Manhattan on misdemeanor public lewdness charge, said he had told multiple staffers that he was an American citizen, but was still held for four days until DHS realized its mistake and withdrew its detainer.

U.S. District Judge Laura Taylor Swain of the Southern District of New York, however, last year dismissed the suit in its entirety, finding that the complaint had failed to adequately state a claim for relief.

On appeal, the federal government said that the similarity of the two men's names was enough to establish probable cause for Hernandez' detention, citing the convention in Spanish-speaking cultures to shorten surnames.

But Judge Denny Chin of the U.S. Court of Appeals for the Second Circuit flatly rejected that argument as "rooted in the context of immigration enforcement and concerns about the interchangeability of foreign names." In fact, he said, "Hernandez" was the eleventh-most common last name in the United States, and the mix-up did not excuse "easily confirmable differences" between the two men.

"Accordingly, we conclude that no reasonable officer would have issued the detainer in the circumstances alleged here, without conducting an inquiry," Chin wrote in a 40-page opinion.  "And the complaint alleges facts from which one could conclude that a reasonable inquiry would have revealed that Hernandez was a U.S. citizen who could not have been subject to an immigration detainer."

Though the ruling did knock out claims for failure to train, abuse of process and negligence, Hernandez would also be allowed to pursue claims against the city for its alleged official policy of "blindly honoring" federal immigration detainers.

"While we do not hold that an officer is required to investigate every claim of innocence, the City had an independent obligation to verify Hernandezʹs citizenship in the circumstances here," Chin wrote. "Where there is a discrepancy in the names and an individualʹs citizenship can be verified with minimal effort, the City is not free to ignore a claim of innocence."

He was joined in the ruling by Judge Richard C. Wesley of the U.S. Court of Appeals for the Second Circuit and U.S. District Judge Lewis A. Kaplan of the Southern District of New York, who sat by designation.

Since Hernandez' arrest, New York has become a sanctuary city, and now limits the cooperation it provides the federal government in enforcing immigration law. Nicholas Paolucci, a spokesman for the New York City Law Department on Tuesday highlighted the change in law when responding to the ruling.

"We're pleased the court rejected plaintiff's failure-to-train claim in this case arising out of the federal government's mistaken issuance of a detainer," Paolucci said in a statement. "In 2014 the city enacted a law requiring a judicial warrant in order for [Department of Corrections] to honor a detainer which should prevent an error like this from reoccurring."

Jeffrey A. Rothman, a Manhattan-based attorney who represents Hernandez, was not immediately available to comment.

The U.S. Attorney's Office for the Southern District of New York declined to comment.

The case is captioned Hernandez v. U.S.