Boston Community Capital thinks it has a solution to clear the backlog of troubled mortgages that continues to hang over parts of the country: Buy them.

It has bought nearly 400 homes in four years, and it now has an eye on Baltimore and Prince George’s County — where the impacts of the housing crash are still being felt.

Through its Stabilizing Urban Neighborhoods initiative, Boston Community Capital buys homes in some stage of foreclosure. It then resells them to the occupants with new 30-year, fixed-rate mortgages. On average, homeowners see their monthly mortgage payment and loan balance reduced by 40 percent, according to the nonprofit organization.

Boston Community Capital plans to buy an additional 75 homes in Massachusetts and other states with the help of a $25 million loan it received from East Boston Savings Bank this spring. It is looking for local partners in Maryland to expand the program into the region, said Elyse Cherry, chief executive of the 28-year-old community development financial institution.

“Nobody has benefited from evicting people,” Cherry said. “It’s better to keep people in their home, keep a floor under housing prices and keep the community stable.”

Nationwide, the pace of foreclosures has slowed. The number of houses in some stage of foreclosure in the first half of this year fell 23 percent from the same time a year ago, according to RealtyTrac, a foreclosure-listing firm.

Not every area is seeing conditions improve, however. Maryland, with 18,861 foreclosure filings, saw a 131 percent jump in foreclosure activity in the first six months of the year. One in every 76 homes is in foreclosure in Baltimore, the epicenter of the state’s housing troubles, according to RealtyTrac.

Another hard-hit area, Prince George’s, had 2,802 homes in the early stages of the foreclosure process as of last month, the second highest number of filings in Maryland.

Housing Options & Planning Enterprises, a foreclosure-prevention organization in Oxon Hill, gets nearly as many visits from struggling families as it did during the worst of the recession, said Donna Hurley, its executive director. She said some of those homeowners are government workers who have been forced to take unpaid days off because of budget cuts.

“When you’re losing hours and income, and cost of living is steady rising, it has an impact on people being able to pay the mortgage,” Hurley said.

Foreclosures have ravaged communities across the country. Massachusetts, where the SUN program is based, is experiencing a decline in new filings, but only after years of lenders repossessing tens of thousands of homes throughout the state. The nonprofit organization negotiated a new mortgage of $1,141 a month, a 31 percent reduction from the previous price. The nonprofit’s program may not work for every struggling homeowner, and the group isn’t offering the cheapest mortgages. Its mortgages come with a 6.38 percent interest rate, which is at least two percentage points higher than average market rates. But Cherry said the rate is far lower than what the high-risk borrowers the nonprofit group works with could likely get elsewhere.

Lynne and Nancy Andresse almost saw their home meet a similar fate.

The couple owed $185,396 on their home when they approached Boston Community Capital in January.

For nearly three years, the Andresses struggled to pay a $1,653 monthly mortgage amid a job loss and an illness in the family.

Lynne Andresse, 59, said she and her wife applied to have their monthly payments lowered, but the mortgage servicer repeatedly lost their paperwork. At one point, she paid $3,500 to a housing counselor, but she was told there was nothing that could be done.

“I broke down at school and had a panic attack. And in the middle of it, a friend told me about Boston Capital,” said Andresse, an elementary school teacher.

The monthly mortgage payments also can’t exceed 38 percent of the borrower’s monthly income, and borrowers must make a down payment of $5,000.

There are also closing costs and fees. The company charges a one-time fee of $3,000 to defray the cost of buying the home. Closing costs, including taxes and insurance, typically tops $8,000.Valerie Smith, 56, was not put off by the program’s requirements.

Boston Community Capital also requires that borrowers establish a reserve account for each homeowner equal to 1.5 percent of their loan. The idea is to create a rainy day fund that families can tap if the roof starts leaking or someone loses their job.

For years, Smith borrowed against her mortgage to keep her family’s dry-cleaning business afloat. By 2011, they were paying $4,722 a month for a home they bought for $250,000 in 1989.

“I couldn’t afford that mortgage,” she said. “But somebody tells you you’ve been approved, and here’s money to bail out your business and you just do it.”

As the bank ramped up threats of foreclosure, the couple decided to try Boston Community Capital.

“They fought for me like it was their house,” Smith said.

Perhaps one of the biggest obstacles to scaling up the SUN program is convincing investors that borrowers will keep up with their payments, Cherry said.

“The concern we hear from investors is with a bunch of folks in default or foreclosure, why do we expect them to be good borrowers,” she said. The program has two dozen investors, mainly high net worth individuals. Now that the nonprofit has secured its first loan with the East Boston deal, Cherry said she hopes it will attract more investors.

So far, only one homeowner in the program has landed in foreclosure, and a few have been late on payments, Cherry said. But “if a borrower gets into trouble, we can try and sort it out,” she said.