A judge on Staten Island has ruled in favor of Mayor Bill de Blasio in a lawsuit over whether or not he can delete IDNYC cardholder data.

Judge Philip Minardo ruled that the court cannot prevent the destruction of the information or require de Blasio to keep it. 

As part of city law, the information from the applications would be deleted after two years. 

Facing concerns over whether the information could be used to aid President Donald Trump's deportation efforts, de Blasio also said "additional approaches" may be taken to ensure privacy of the cardholders. 

Two state Assembly members from Staten Island, Nicole Malliotakis and Ron Castorina, Jr., sued the mayor in an effort to prevent him from deleting it.

Malliotakis said she and Castorina are concerned about what the ruling means for "government transparency and public safety."

"What does it mean if a government entity is allowed to destroy documents that are FOILable and subject to judicial inquiries, and could be used to aid law enforcement?" she said in a statement. "We intend to pursue further options to prevent the mayor's irresponsible actions that put all New Yorkers at risk."

De Blasio vowed to fight any appeal of the ruling, but stopped short of saying what his administration would do with the data moving forward.

"IDNYC was created to protect people and connect them to vital services and today’s decision ensures it will continue to do just that," he said. 

A spokesman for the mayor said since there is a stay on the removal of the data until at least April 17, any changes to the status of the information would be evaluated at a later time. 

Attorney General Eric Schneiderman, who supported de Blasio's cause, called the decision a win.

"The decision protects the personal information for those New Yorkers, including some of our most marginalized and vulnerable populations, and mitigates their risk of identity theft or hate crimes," he said in a statement.

"I was proud to file an amicus brief in support of the city, and stand ready to join the administration in fighting any appeal from today’s ruling,” he continued.

The IDNYC program, which is overseen by the city's Human Resources Administration, was meant to "assist vulnerable populations, including homeless, victims of domestic violence and undocumented immigrants," Nisha Argarwal, the city's commissioner for immigrant affairs, said in her testimony, according to the judge's decision.

Applications for the program could include photographs, driver's licenses, emergency contacts and date of birth.

The NYPD's Deputy Commissioner of Intelligence John Miller testified that retaining records of applicants was a safety risk, noting that any network could be hacked, the decision shows.

Malliotakis and Castorina also filed FOIL requests for the cardholder data, but were denied, according to the lawsuit. Judge Minardo said the assembly members may have been "entitled to a redacted and burdensome production" of the information, but since they did not specifically make that request, he could not order the information to be given to them. 

"Considering the lack of a formal request, the unduly financially burdensome nature of the production, and the lack of good cause shown, there is no reason for this Court to order the production," he said. 

Since its launch in January 2015, over 1 million people have applied for an IDNYC card, the mayor’s office said. There has been a steady decrease in applications since the program started, according to data from the Office of Immigrant Affairs.