For years, a group of low-income tenants in north Minneapolis fought landlord Mahmood Khan over shoddy maintenance and constant threats of eviction.

On Friday those tenants were all smiles as they became owners of the properties they lived in. Under the arrangement, the buildings will be rehabbed.

The unusual deal capped lengthy negotiations and the collaboration of a tenants’ rights group, a nonprofit land bank organization, and financing from the city, state and a local foundation.

“I’m ecstatic,” said Tim Brown, 57, one of the tenants who became a homeowner.

“I feel great,” said Tecara Ayler, 40, another new homeowner. “I feel like all the fighting we did wasn’t for nothing.”

On Friday morning, Khan, who has been banned by the city from holding rental licenses, signed the papers to sell four single-family homes and a duplex to the City of Lakes Community Land Trust for $615,000.

Hours later, the tenants signed contracts for deed with the trust, turning them into homeowners. The trust will rehab the buildings.

“It is — by far — one of the most inspirational things I’ve ever been part of,” said Jeff Washburne, executive director of the land trust.

Mayor Jacob Frey said Friday he was pleased with the resolution.

“As a city, Minneapolis is committed to strengthening tenants’ rights,” the mayor said. “Our city staff has led an incredible team effort with the land bank to find a just resolution, which is safe and stable housing for tenants and families whose lives have been upended.”

Key to the purchases was a $300,000 grant and $690,000 low-interest loan from the Pohlad Family Foundation. The city of Minneapolis contributed $250,000 in federal funds it received for housing rehabilitation and the Minnesota Housing Finance Agency chipped in $157,000.

The funds are being used to buy and renovate the five properties from Khan and purchase a sixth home that was recently rehabbed by a nonprofit for a Khan tenant.

The new homeowners will meet regularly with a home buyer credit counselor to improve their credit and reduce their debt so they can become eligible for a conventional mortgage, Washburne said. They also will get some coaching to help increase their income. Should the new owners sell their properties, the deal will ensure that the buildings remain affordable housing for lower-income people, Washburne said.

The tenants had been organized by United Renters for Justice. Washburne credited the organization for keeping all the parties together to hammer out the deal.

“I feel happy.” said LaKesha Davis, 40, who is acquiring a home in the 1600 block of Sheridan Avenue N. “I never thought we were going to get this far.”

“I don’t have to move anymore,” said Nicole Anderson 40, who will now own a duplex on the 1000 block of Logan Avenue N. “And I don’t have to worry about who’s going to rent to me.”

The trust is also attempting to negotiate with Khan to buy 35 other properties. In the past, some tenants withheld rent, demanding repairs. Khan said when he wasn’t paid, he sought evictions.

Khan was in a positive mood Friday. “I feel good everybody has a place to stay, which was my goal,” he said.