NEW YORK (AP) — A U.S. immigration judge cleared the way Wednesday for fake German heiress Anna Sorokin to be released from detention to home confinement while she fights deportation, if she meets certain conditions.

She must post a $10,000 bond, provide a residential address where she’ll stay for the duration of her immigration case and refrain from social media posting, Manhattan Immigration Judge Charles Conroy said.

Sorokin, 31, has been in U.S. Immigration and Customs Enforcement custody since March 2021, after spending more than three years behind bars for swindling banks, hotels and friends to bankroll a posh lifestyle.

Anna Sorokin leaves after sentencing at New York State Supreme Court, in New York, May 9, 2019. A U.S. immigration judge cleared the way Wednesday, Oct. 5. 2022, for fake German heiress Anna Sorokin to be released from detention to home confinement while she fights deportation, if she meets certain conditions. (AP Photo/Richard Drew, File)

Immigration authorities say she’s overstayed her visa and must be returned to Germany.

Sorokin’s lawyer, Duncan Levin, said they are “extremely gratified” by the decision to release her to home confinement.

“The judge rightfully recognized that Anna is not a danger to the community,” Levin said in a written statement. “While there are still a few hurdles to jump through on her release conditions, Anna is thrilled to be getting out so she can focus on appealing her wrongful conviction.”

A message seeking comment was left with Immigration and Customs Enforcement.

Sorokin, whose scheme inspired the Netflix series “Inventing Anna,” was convicted in 2019 on multiple counts of larceny and theft. She was sentenced to four to 12 years in prison, credited with more than 500 days time served while her case was pending and released on good behavior in February 2021.

In this April 22, 2019 file photo, Anna Sorokin, who claimed to be a German heiress, arrives for her trial at New York State Supreme Court in New York. The New York Attorney General’s Office recently invoked a state law that forbids criminals from profiting off their crimes in a court challenge to a Netflix deal Sorokin signed last year. Prosecutors say proceeds from the production should go to the Manhattan banks and hotels Sorokin defrauded out of nearly $200,000. (AP Photo/Richard Drew, File)

Immigration authorities picked her up a few weeks later.

Using the name Anna Delvey, Sorokin maneuvered her way into elite New York social circles by passing herself off as a socialite with a $67 million (68 million euros) fortune overseas, prosecutors said. She falsely claimed to be the daughter of a diplomat or an oil baron.

Prosecutors said Sorokin falsified records and lied to get banks to lend, luxury hotels to let her stay and well-heeled Manhattanites to cover plane tickets and other expenses for her, stealing $275,000 in all.