(Reuters) - The cities of New York, San Francisco and Philadelphia have sued the U.S. Department of Defense to make it fix its system for reporting conviction records to a database used for background checks on gun buyers.

The lawsuit was filed on Friday in federal court in Alexandria, Virginia and came after the U.S. Air Force revealed it failed to report the criminal record of the man who in November killed 26 people and wounded 20 others in a shooting at a Texas church.

The complaint, announced on Tuesday, said it sought an injunction to prevent future “senseless carnage” by requiring the Defense Department to locate all records in its possession that should be reported in order to fix “deadly gaps” in the background check database.

“New York City is joining Philadelphia and San Francisco to stand up to the Department of Defense and demand they comply with the law and repair their drastically flawed system,” New York City Mayor Bill de Blasio said in a statement.

The three cities are led by Democrats, some of whom have advocated stricter gun controls.

The Defense Department said that it did not comment on pending litigation.

Former Airman Devin Kelley - who opened fire in the First Baptist Church in Sutherland Springs, Texas, on Nov. 5 - was convicted five years ago by a general court-martial on two charges of domestic assault against his wife and stepson.

The Air Force said that information was not entered into the National Criminal Information Center database, which the Federal Bureau of Investigation oversees and uses to run required background check requests from gun dealers before a sale.

Attorney General Jeff Sessions has since ordered the Justice Department to undertake a review of the system to help plug potential reporting gaps.

The Department of Defense Inspector General earlier this month released a report that found that all military services “consistently” failed to submit fingerprint data for 24 percent of the convicted offenders reviewed.