Philadelphia and two other major U.S. cities sued the Department of Defense in federal court this week, arguing that many military service members who were disqualified from gun ownership weren't reported to the national background check system.

The DoD repeatedly failed to report certain criminal history and dishonorable discharge data for service members into the FBI's national background check system, attorneys representing Philly, New York City and San Fransisco said in the suit.

In a statement, Mayor Jim Kenney added that Philly, long plagued by gun violence, relies on the database while conducting background checks on those applying for a gun permit.

"We’re joining in this suit because reporting these records is absolutely critical to those decisions," Kenney said. "The background check system only works if it contains the proper records.”

The cities also Philly, New York and San Fransico claimed that the military's "broken" system for reporting the information helped lead to the mass shooting in a Texas church last month that claimed 26 lives.

Federal and Pennsylvania state laws bar those with a criminal background or a dishonorable discharge from purchasing firearms or receiving gun-related licenses.

The cities seek an injunction and judicial oversight that, if granted, would obligate the DoD to ensure that all current and past disqualifying records be submitted to the background check system. It would also "ensure that appropriate systems are in place to achieve ongoing compliance and hold accountable those responsible for record submission," Philadelphia officials said.

Military officials have acknowledged past problems with their reporting, and the Pentagon's watchdog agency found a "troubling" number of failures this year by the military to alert the FBI on criminal history matters, the Associated Press noted.

The lawsuit reportedly names the armed forces, the Department of Defense and Defense Secretary Jim Mattis and other officials.