The ruling said Devyani Khobragade had diplomatic immunity when she was indicted on charges of fraudulently obtaining a work visa for her housekeeper and lying about the maid’s pay.

NEW YORK — An Indian diplomat whose arrest and strip-search spurred an international flap had charges against her dismissed by a federal judge on Wednesday.

The judge’s ruling said Devyani Khobragade had diplomatic immunity when she was indicted on charges of fraudulently obtaining a work visa for her housekeeper and lying about the maid’s pay. But the ruling leaves open the possibility prosecutors could bring a new indictment against her.

The U.S. attorney’s office in Manhattan didn’t immediately comment on its plans.

Khobragade’s attorney, Daniel Arshack, said she was pleased by the ruling.

“The judge did what the law required, and that is: that a criminal proceeding against an individual with immunity must be dismissed,” Arshack said. “She’s (Khobragade’s) hugely frustrated by what has occurred. She is heartened that the rule of law prevailed.”

After being indicted, Khobragade complied with a Department of State order to leave the U.S. The Indian government then asked Washington to withdraw a diplomat from the U.S. Embassy in New Delhi. The U.S. complied.

Wednesday’s ruling centers on the complexities of different levels of legal protection afforded to diplomats. When Khobragade was arrested in December, U.S. officials said her status as a consular officer provided immunity limited to acts performed in the exercise of official functions. She disagreed, and then, on the day before her Jan. 9 indictment, she got a new appointment that conferred broader immunity.

Regardless of Khobragade’s status when she was arrested, her later appointment gave her immunity when indicted and means the case must be dismissed, U.S. District Judge Shira Scheindlin wrote. And while Khobragade’s immunity ended when she left the country, U.S. prosecutors still don’t have jurisdiction over her, the judge wrote.

The judge said that mooted the question of whether the crimes Khobragade was accused of committing would have been considered “official acts” covered by the earlier, more limited immunity. If not, the judge wrote, “then there is currently no bar to a new indictment against Khobragade.”

A federal prosecutor ventured into the tense relationship between the U.S. and India in December, defending the arrest and strip-search of Khobragade and saying she was treated very well, even given coffee and offered food while detained.

U.S. Attorney Preet Bharara said Khobragade was afford courtesies most Americans wouldn’t get — such as being allowed to make phone calls for two hours to arrange child care and sort out personal matters — after she was discreetly arrested by U.S. Department of State agents outside her children’s Manhattan school.

Khobragade was arrested on charges she lied on a visa application about how much she paid her housekeeper, an Indian national. Prosecutors said the maid received less than $3 per hour for her work.

Bharara, who was born in India but moved with his family to New Jersey, said Khobragade, who had pleaded not guilty, wasn’t handcuffed, restrained or arrested in front of her children. And he said that while she was “fully searched” in private by a female deputy marshal, the move was a standard safety practice all defendants undergo.

News that Khobragade was strip-searched chilled U.S.-Indian relations, and U.S. Secretary of State John Kerry called a top Indian official to express his regret over what happened.