Hundreds of low-level Manhattan pot offenders will have their arrest records sealed under a judge’s ruling, officials announced Monday.

The ruling came in response to an April class-action lawsuit filed by Manhattan District Attorney Cy Vance and three anonymous individuals who are seeking to seal their own records — along with the records of 363 other people who have had no other misdemeanor or felony convictions, no convictions in the past 10 years and no pending cases.

The offenders would normally have to file a sworn affidavit requesting their cases be sealed, but Vance sought to bypass that process because of difficulties contacting all of the class members.

Manhattan Supreme Court Justice Carol Edmead granted the petition July 22.

The three anonymous plaintiffs — who were charged for either smoking or possessing marijuana in public — said convictions from as long as 17 years ago have permanently tarnished their records and hindered them in finding jobs, according to the petition.

“There’s no reason a conviction for smoking or possessing marijuana should follow New Yorkers for life,” Vance said in a statement.

“This class action transforms New York’s complicated sealing laws by making sealing proactive, instead of requiring people who are eligible for sealing to navigate a complex application process,” he continued. “But civil sealing only goes so far: we must eliminate the needless collateral consequences associated with the criminalization of marijuana by legalizing its recreational use once and for all.”

The Legal Aid Society, which joined the DA’s petition, cheered the ruling.

“This new approach addresses one of the biggest challenges at the heart of the current sealing process. Filing individual actions is far too cumbersome and needs to be simplified,” said Emma Goodman. “Despite New York’s recent efforts, too many people are still prevented from leading the successful and rewarding lives they deserve. Until the sealing law changes, we are using all of the tools at our disposal to help as many people as we can.”