MADISON, Wis. (AP) — The Wisconsin Department of Justice must expunge arrest records of people who aren’t charged from its criminal database, a state appeals court ruled Tuesday.

The decision centers around Demonta Antonio Hall of Milwaukee.

According to court documents, Hall was arrested in 2015 for possession of an electronic weapon but prosecutors decided not to charge him two days after the arrest. When he was arrested he had an outstanding warrant for a traffic citation. He pleaded guilty and paid a fine on the same day prosecutors decided not to charge him in the weapons arrest.

Hall was arrested again in 2017, this time for second-degree sexual assault. Two days after the arrest prosecutors decided not to charge him. At the time of that arrest he again had an outstanding warrant, this time for disorderly conduct. He was fined in connection with that offense.

The Justice Department fused all the arrests and convictions into one file in its criminal database in accordance with agency procedures. The database is a public record that forms the basis of criminal background checks.

Hall asked the department to expunge the weapon and assault arrests from his file. State law requires the agency to expunge cases where a suspect isn’t charged from the database. The department refused, however, interpreting the statutes to mean that people must be cleared of all offenses in their record before anything can be expunged. Hall didn’t meet that criteria because he wasn’t cleared of his traffic and disorderly conduct citations.

Hall sued in 2017 demanding the department expunge the weapon and assault arrests. A Milwaukee County judge agreed with him; the Justice Department appealed.

The 2nd District Court of Appeals sided with Hall, finding that state law plainly says that anyone who is arrested but not charged is entitled to have the record of that case expunged from the database. The court added that the Justice Department has no legal authority to fuse unrelated charges together to prevent expungement.

Asked for comment, Justice Department spokeswoman Rebecca Ballweg said only that the agency was reviewing the decision.

The nonprofit law firm Legal Action of Wisconsin represented Hall in the case. Firm spokeswoman Rachel Fox Strong declined comment, saying the firm typically doesn’t talk about cases until the window for all appeals has closed and the Justice Department could ask the state Supreme Court to take the case.