District residents who have been convicted of nonviolent marijuana offenses could apply to have those criminal records sealed under a bill granted initial approval by the D.C. Council on Tuesday.

The change is being considered amid a period of great upheaval for the city’s marijuana laws, which have gone from strict prohibition to the cusp of legalization within a span of months. In March, lawmakers voted to limit the penalties for minor cases of possession to a civil fine no more serious than a parking ticket. Next month, city voters will consider whether to legalize the possession of up to two ounces of marijuana for personal use.

Council member David Grosso (I-At Large), who introduced the record-sealing bill, said his legislation is a companion to the other measures. He said it is a matter of fairness to give prior offenders some ability to scrub their records now that city leaders have pursued a liberalized marijuana policy.

“People who have had these issues in the past, it never leaves them,” Grosso said. “They have to check the box [indicating a prior conviction]. They can’t get a job. They can’t get public housing. They can’t get financial aid” for college.

Under the bill, residents could file a motion to seal in D.C. Superior Court, which would be granted unless prosecutors could show that the offense in question remains a crime. If granted, prosecutors and courts would have to remove public records relating to that individual’s arrest, charge, trial or conviction.

The measure, which passed 12 to 0 and is subject to a second vote set for later this month, is among the broadest efforts to allow marijuana records to be sealed in the country, according to Grosso and data compiled by the Drug Policy Alliance, a group advocating for legal reforms.

In other business Tuesday, the council granted initial approval to a bill setting affordable housing benchmarks for projects developed on city-owned land.

The bill, introduced by Kenyan R. McDuffie (D-Ward 5) and three other members, requires at least one in five multifamily housing units created on public property be made affordable to those making 80 percent or less of the area median income. In some cases, the units would have to be priced to be affordable to those making a fraction of that.

Affordable housing advocates feared that amendments might give a mayor a freer hand to waive those requirements. Despite objections from Mayor Vincent C. Gray (D) and a sharp discussion during a breakfast meeting before the council session, the unamended bill passed 12 to 0.

But one co-introducer, Economic Development Committee chair and mayoral candidate Muriel E. Bowser (D-Ward 4), said she expected “tweaks” before a final vote.

The council also granted approval — again, in the first of two votes — to a bill regulating smartphone-based “ridesharing” services such as Uber and Lyft. Lawmakers voted over the objections of some cabdrivers and the District’s Taxicab Commission, whose chairman said in a letter to the council that the regulatory requirements it established are too lax.

Lawmakers also passed emergency legislation banning owners of grocery stores from restricting buyers of their property from opening up new grocery stores. That measure, from Mary M. Cheh (D-Ward 3) and David A. Catania (I-At Large), was prompted by the marketing of the Safeway store in Palisades to real-estate developers, which has residents there fearing such a covenant could close the neighborhood’s only grocery.

A Safeway executive wrote to Council Chairman Phil Mendelson (D) on Monday, defending the covenants as a “common business practice” and “important to help ensure business success in the long term.” But Mendelson said Tuesday that the letter made him more inclined to support the ban, not less.