STATEN ISLAND – A judge says New York City is legally allowed to destroy personal documents associated with its municipal identification program.

However, the judge also issued a stay Friday — postponing any action until April 17, pending an appeal.

Two state Assembly members have sought to prevent the destruction of documents, such as copies of foreign passports, used to verify a person’s identity to obtain the IDNYC card.

According to The New York Times, Judge Philip G. Minardo says purging the documents would not be a threat to national security as the legislators have claimed.

The card can be used by people without a driver’s license or an American passport.

Advocates say keeping the documents could lead authorities to the applicants, putting them at risk of deportation.

Mayor de Blasio applauded the decision Friday, just mere days after the amount of registered IDNYC cardholders surpassed one million.

“With this decision the State Supreme Court protected the personal information of a million New Yorkers,” de Blasio said.

“IDNYC was created to protect people and connect them to vital services and today’s decision ensures it will continue to just do that. We applaud the ruling and will fight any attempt to appeal it.”

The Associated Press contributed to this report.