A Copiague man was sentenced Friday to 12 1⁄2 years in prison for masterminding a scheme to swindle banks out of more than $20 million by fraudulently obtaining mortgages during the real estate market boom more than a decade ago.

Federal prosecutors said Aaron Wider’s scheme inflated property values, contributing to the market’s eventual bust and Long Island’s blight of zombie houses — abandoned, uncared-for houses mired in foreclosure.

Wider, 50, the former head of mortgage bank HTFC Corp. based in Garden City, was convicted of conspiracy to commit bank fraud in January 2016 after a four-week trial in federal court in Central Islip.

U.S. District Judge Arthur Spatt also sentenced Wider to 5 years’ supervised release and ordered him to undergo mental health and drug counseling.

Spatt required Wider to make restitution of $22 million, but the judge said that was unlikely due to the defendant’s current lack of financial resources.

Eastern District Assistant U.S. Attorney Artie McConnell, who prosecuted the case along with Allen Bode, had asked that Wider receive a maximum, 30-year sentence because of his “brazen” conduct.

advertisement | advertise on newsday

“Long Island became the epicenter of zombie houses because of people like Aaron Wider,” McConnell said.

Spatt said 30 years would be “draconian” punishment, even for such a “tremendously fraudulent, extensive scheme.”

The judge, who is proud of his own Navy service, said he took into consideration that Wider served in the Navy, although federal prosecutors argued that he received an administrative discharge due to “violent, drunken and insubordinate behavior.”

Wider did not comment in court, or following the sentencing.

His attorney, Aaron Goldsmith of Manhattan, declined to comment afterward, except to say that Wider plans to appeal.

Acting U.S. Attorney Bridget Rohde said in a statement: “Aaron Wider perpetrated a massive mortgage fraud scheme, the effects of which are still felt to this day by financial institutions and homeowners. . . . Today’s sentence sends a strong message that those who manipulate and abuse the lending process will be held accountable.

“Wider’s scheme won him millions of dollars in profits and delivered a crushing blow to the financial institutions who became unwitting players in this game,” she said.

There was witness testimony and documentary evidence during the trial that Wider’s associates bought the houses, and along with Wider, transferred them to a trust they set up on the same day. They then used an inflated assessment to ostensibly resell the houses to an associate in the scheme at much higher prices — sometimes double the original purchase price.

They used the sham inflated price to obtain what prosecutors called falsely overvalued “toxic” mortgages in the secondary market, pocketing the difference between the real and inflated values, prosecutors said.

All of the homes, bought and resold between 2003 and 2008, wound up in foreclosure, leaving banks and investors on the hook for the inflated value after the real estate market crashed in 2008.

advertisement | advertise on newsday

Several of Wider’s associates were convicted in the scheme and are awaiting sentencing.

Nassau County Deputy Assessor Eileen Ryan told the jury during Wider’s trial that she flagged suspicious transactions with HTFC holding the mortgage. For example, one Wider associate bought a Carman Mill Road property in Massapequa for $450,000 on Jan. 31, 2007, and immediately transferred it to a trust. The same day, the property was resold for $800,000, she said.

“On its face, unexplainable,” she testified. “There was a whole pocket with that same pattern.”

In a 2007 interview with Newsday, Wider denied any wrongdoing, saying he simply bought houses in poor repair, fixed them up and resold them.