Gov. Andrew Cuomo has approved legislation designed to outlaw the kind of legal limbo that has enveloped thousands of homeowners facing foreclosure.

Consumer advocates have long decried the so-called "shadow dockets," in which homeowners facing foreclosure find their problems compounded when their lender or loan servicer discovers it doesn't have sufficient documentation to determine who actually owns the loan.

Now, parties wishing to foreclose on a home must get a "certificate of merit" proving that they actually own the mortgage before initiating the foreclosure process.

And those who do will have to set up a mandated settlement conference within three months. At such conferences, homeowners and lenders try to work out a deal to avoid moving ahead with foreclosure — perhaps by reconfiguring the loan or writing off part of the debt.

In the wake of the 2008 financial collapse, homeowners nationwide started facing foreclosure in greater numbers. But because mortgages had frequently been bundled, swapped and sold to other parties, it wasn't always easy to prove who actually owned a particular loan.

Further confusing things was the prevalence of "robo-signing," in which law firms or servicers signed off on mortgages without thorough documentation.

Judges in New York have since cracked down on that practice, but those reforms haven't led to a resolution of delinquent loans, since they could end up in shadow dockets.

Some homeowners have received foreclosure notices, but then ended up waiting as long as two years for their settlement conferences — with interest accruing all the while, said Kirsten Keefe, a senior staff attorney in the Empire Justice Center's housing unit, which has pushed for change.

The new law should also ensure that foreclosures are properly carried out with all the required paperwork in place. "This puts an incentive for them to actually do their homework," Keefe said.

Keefe cited estimates that 92 New Yorkers each day end up in shadow dockets.

Passage of the bill, sponsored by Independent Democratic Conference leader Jeff Klein in the Senate and Democrat Helene Weinstein in the Assembly, drew plaudits from groups ranging from AARP to Attorney General Eric Schneiderman, as well as the Empire Justice Center.