“Insomuch as the conduct for which the defendant was convicted is no longer criminal, setting aside the conviction and dismissing the case serves the interests of justice,” the judges wrote.

Seattle Municipal Court judges have agreed to vacate convictions and dismiss charges for misdemeanor marijuana possession prosecuted before pot was legalized in Washington state.

City Attorney Pete Holmes filed a motion in April asking the court to take the historic step for all convictions and charges between 1996 and 2010 “to right the injustices of a drug war that has primarily targeted people of color.”

All seven of the court’s judges signed an order Sept. 11 setting out a process for nixing the cases. As many as 542 people could be affected. The Seattle court doesn’t handle felony cases.

“Insomuch as the conduct for which the defendant was convicted is no longer criminal, setting aside the conviction and dismissing the case serves the interests of justice,” the judges wrote.

The order directs Holmes to hand over the last known address of each person affected. The court will mail out notices, giving each person 33 days to object or seek an individualized finding.

After that, the court will vacate the convictions and dismiss the charges for everyone other than those who have objected or asked for individualized findings.

In a statement, Holmes said the city should “take a moment to recognize the significance” of the court’s ruling.

“We’ve come a long way, and I hope this action inspires other jurisdictions to follow suit,” the city attorney said.

Mayor Jenny Durkan, who joined Holmes earlier this yearin announcing the city’s position on the cases, also hailed the ruling.

“For too many who call Seattle home, a misdemeanor marijuana conviction or charge has created barriers to opportunity — good jobs, housing, loans and education,” Durkan said in a statement.

“While we cannot reverse the harm that was done, we will continue to give Seattle residents … a clean slate.”

The ruling covers cases starting when Seattle took over misdemeanor marijuana prosecutions from King County and ending  in 2010, when the city adopted a policy of no longer carrying out such prosecution

Seattle took an intermediate step in 2003, when voters approved a ballot measure making personal-use marijuana offenses the city’s lowest enforcement priority.

In 2010, soon after Holmes was elected, he dismissed the city’s active marijuana-possession cases and said his office would prosecute no more.

 Washington legalized the possession and recreational use of marijuana for adults 21 years or older in 2012, when voters approved state Initiative 502.

Misdemeanor marijuana prosecutions between 1996 and 2010 disproportionately affected people of color, “and the African-American community in particular,” the Seattle Municipal Court judges wrote this month, noting that an estimated 46 percent of the defendants were black.

The process of clearing the cases has taken months partly because of the unusual nature of the effort and because the city spent time trying to figure out how to make the dismissals count under federal immigration law.

Since 1996, immigration courts have defined criminal convictions more broadly than local courts, so noncitizens can run into immigration problems even after their convictions are vacated.

Holmes asked the Seattle court to render the city’s marijuana cases moot under immigration law by ruling that any noncitizens involved were, at the time, not adequately advised of the immigration consequences of their convictions.

The judges declined to make that ruling. Noncitizens whose convictions are vacated will be able to seek the additional relief on an individual basis, said Dan Nolte, a Holmes spokesman.

Seattle isn’t the only metropolis addressing old marijuana convictions. Since January, San Francisco has been working to dismiss misdemeanor and felony convictions.