Updated

A transgender woman arrested by immigration agents while at a courthouse for a protective order hearing had admitted to a money order scheme weeks before, an affidavit shows.

Irvin Gonzalez, an undocumented immigrant from Mexico, was arrested on Feb. 9 in El Paso County Courthouse.

A criminal complaint with a supporting affidavit filed Tuesday by Border Patrol Agent Humberto Chavira states that Gonzalez admitted to the crime on Jan. 13, after she and her partner Mario De Avila were caught stealing mail from blue U.S. Post Office drop-off boxes.

ILLEGAL IMMIGRANT TAKES REFUGE IN DENVER CHURCH TO AVOID DEPORTATION

According to the affidavit, the scheme consisted in taking money orders, washing the name off with transmission fluid, adding De Avila’s name and depositing the money into his bank account.

De Avila was arrested and charged with forgery.

A couple of weeks after the incident, El Paso Police Department Authorities alerted a Border Patrol agent of Gonzalez’s presence in the country — during a follow up interview she had openly admitted to cops that she was in the U.S. illegally. She had also volunteered that she had a protective order (against De Avila) hearing on Feb. 9.

AGENTS DETAIL 'DAILY' BORDER FENCE BATTLE, SEEK POST-OBAMA 'RESTART'

Federal officials used that information to look up her hearing and showed up to the courthouse, the affidavit says.

The case got attention from Congressman Beto O’Rourke and El Paso County leaders, who expressed concern over the fact that she was arrested inside a courthouse.

MAN SUSPECTED IN AMBER ALERT HAD BEEN PREVIOUSLY DEPORTED

The public defender representing Gonzalez filed a petition for her immediate release saying that a Border Patrol agent perjured himself because in a first version of the affidavit he wrote that the arrest happened outside the building. Security footage shows them escorting her out from the 10th floor of the courthouse.

Jail records show Gonzalez, who was charged with forgery on Feb. 15, remains in the El Paso County jail.

She was first arrested and voluntarily returned to Mexico on June 5, 2007. She was then deported again, twice in 2011, once in 2013, 2014, and 2016.

In 2011 she was sentenced to over a year in jail for crimes including domestic battery, illegal entry, and possession of stolen mail.