New York City will reimburse the federal government more than $5 million for its attempt to scam the Federal Emergency Management Agency with bogus claims it submitted after Superstorm Sandy hit the city in 2012, according to a settlement filed in Manhattan federal court Wednesday.

U.S. Attorney Geoffrey Berman in Manhattan said the incident took money FEMA should have been able to give to "legitimate disaster victims in desperate need." Instead, city officials in Democratic Mayor Bill de Blasio's administration attempted to claim millions of dollars the city was ineligible to receive.

The city told FEMA in May 2014 that it lost 132 Department of Transportation vehicles as a result of the storm and asked to be reimbursed $4.13 million by the Department of Homeland Security for replacements. But the federal government learned that many of the passenger, commercial, and heavy equipment vehicles had been damaged or deemed inoperable before Sandy struck New York.

"Many of the vehicles for which the City sought full replacement costs had been nonoperational or not in use prior to the storm," according to the U.S. Attorney's office in the Southern District of New York. "As a result of these false certifications, FEMA paid the City millions of dollars to which it was not entitled."

New York City officials admitted to falsely claiming $4.13 million in damages and agreed to relinquish the rights to another $1.18 million that FEMA had previously approved for the Berman's office said in a news release. New York has also withdrawn requests for another $3.20 million after acknowledging they were not legitimate requests.

A federal judge will have to approve the settlement.

The city has since appointed a new compliance officer and implemented a new system to track its thousands of city vehicles.

A spokesman for the city's transportation department said the city cooperated with the U.S. attorney's office after being contacted in 2016 about its claim.

"In 2016, the U.S. Attorney for the Southern District alerted DOT that reimbursement claims submitted by the agency to FEMA included damaged vehicles that may not have been eligible for reimbursement. We cooperated fully with the subsequent review, and worked together to reach an amicable settlement," spokesman Scott Gastel said in a statement.