The Massachusetts Division of Banks said Wednesday that new regulations will prevent national and state lenders from foreclosing on a homeowner’s property if modifying their mortgage loans cost less.

The regulations, a product of legislation signed by Governor Deval Patrick last August, require lenders to consider all available loss-mitigation options before proceeding to foreclosure. After several months of drafting, the regulations have now just gone into effect.

Foreclosures surged during the recession as many homeowners who lost jobs were unable to keep current with their monthly mortgage payments.

Advertisement - Continue Reading Below

But now Massachusetts foreclosure numbers are down, partly because of an improving economy and partly because some lenders were waiting to see whether the new regulations would prompt them to revise their foreclosure procedures, analysts have said.

Last week, the Warren Group, a Boston firm that tracks real estate activity, reported that 1,246 foreclosure deeds were recorded in Massachusetts during the first five months of the year, down almost 69 percent from 4,011 for the same period from a year earlier. Foreclosure deeds represent completed foreclosures.

The Warren Group’s report included a statement from firm chief executive Timothy M. Warren Jr., who said, “Legislation passed last year that forces lenders to consider alternatives to foreclosure is also contributing to the decrease as lenders revamp their foreclosure procedures to comply.”

In theory, lenders could step up the pace of foreclosure activity now that the Massachusetts regulations have been finalized. But as Warren also pointed out last week, recent “data further supports our argument that the foreclosure crisis is behind us. The combination of a recovering housing market and banks’ willingness to allow for loan modifications has helped suppress foreclosure levels.”

Massachusetts Undersecretary of Consumer Affairs and Business Regulation Barbara Anthony commented on the regulations in a Wednesday statement.

“These regulations are the strongest on the books so far and are an added tool for homeowners across the Commonwealth,” Anthony said. “Lenders are now required to do a net present value analysis before foreclosing. The absence of a requirement like this was certainly a factor in the foreclosure crisis, and we in Massachusetts have taken strong action to remedy this.”

In a separate statement, Massachusetts Commissioner of Banks David Cotney added: “This is a win-win for lenders and consumers, because the cost of modifying a loan is often less expensive than foreclosing. This will assist us in Massachusetts to continue to restore the housing market back to a healthy state.”

According to the division, these regulations add further protections for homeowners by preventing a servicer from initiating foreclosure when an application for a modification is in progress. The regulations, the division added, are similar to standards set out in a settlement agreement reached in early 2012 between five big national lenders and the attorneys general from nearly all states, including Massachusetts.

Massachusetts Attorney General Martha Coakley advocated for the legislation that set up the framework for the foreclosure regulations that have now gone into effect.

In a statement, a Coakley spokesman said: “These regulations are an important step to ensure Massachusetts remains in a strong position to rebound from the housing market decline and recover from the foreclosure crisis. The new rules are a direct result of legislation we filed to promote reasonable loan modifications that keep people in their homes without requiring banks to sacrifice the bottom line.”