Three large U.S. cities filed a federal lawsuit Tuesday against the Department of Defense, arguing that many service members who are disqualified from gun ownership weren't reported to the national background check system.

New York, San Francisco and Philadelphia said in court papers that the military's broken system for relaying such information helped spur the massacre of 26 people inside a Texas church last month.

"This failure on behalf of the Department of Defense has led to the loss of innocent lives by putting guns in the hands of criminals and those who wish to cause immeasurable harm," New York Mayor Bill de Blasio said in a statement. "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."

Local law enforcement officials rely on the FBI's database to conduct background checks on applications for gun permits and to monitor purchases. It must be up to date to prevent people from wrongly getting guns, the cities' attorneys wrote.

The lawsuit, filed in federal court in Alexandria, Va., seeks an injunction and judicial oversight to ensure ongoing compliance with the Defense Department's obligation to submit records.

Military officials previously acknowledged problems with their reporting.

A Pentagon spokesman said Tuesday that he couldn't comment specifically on the lawsuit.

"The department continues to work with the services as they review and refine their policies and procedures to ensure qualifying criminal history information is submitted to the FBI," said Tom Crosson, a Pentagon spokesman.

The Defense Department's failure to report "significant numbers" of disqualifying records to the FBI's national background check system allowed former Air Force member Devin P. Kelley to buy a rifle with which he shot 26 people to death Nov. 5 in a church in Sutherland Springs, Tex., the lawsuit said. Kelley had been convicted of assaulting family members in a 2012 court-martial and should not have been allowed to purchase a gun.

Air Force leaders already acknowledged that the service failed to alert the FBI to Kelley's criminal history and that they discovered "several dozen" other such reporting omissions. Army leaders have said their service also has similar gaps.

Earlier this month, the Pentagon's watchdog agency said it found a "troubling" number of failures this year by the military services to alert the FBI to criminal history information. Attorney General Jeff Sessions has ordered a review of the FBI database.