ALBANY — A new law in New York will require that foreclosed-on properties not be allowed to lie vacant for long and that more protections be built into the foreclosure process for consumers.

The changes were approved in the last hours of the state Legislature’s regular 2016 session and represent, sponsors say, the latest attempt to protect consumers against losing their homes due to nonpayment of mortgages and to neighborhoods and to whole communities hit by the approximately 1 million foreclosure filings in New York state since the recession of the late 2000s.