Joseph McCray, 54, was sentenced to up to 15 years in prison for stealing a Bed-Stuy brownstone using a judge's forged signature, officials said. View Full Caption Courtesy of the Brooklyn District Attorney's Office

BROOKLYN — A man was sentenced to up to 15 years prison on Wednesday for stealing a Bedford-Stuyvesant brownstone by forging a judge’s signature, according to the Brooklyn District Attorney’s Office.

Joseph McCray, 54, filed a fraudulent court order with the City Register in 2015 for a four-family property at 119 MacDonough St. near Throop Avenue, prosecutors said.

McCray had forged the signature of Brooklyn Civil Supreme Court Justice Yvonne Lewis, and the document gave him ownership of the building.

The saga began years prior, when the building was bought from the New York City Department of Housing Preservation and Development in 2000 by a woman who kept McCray as a tenant. He didn’t pay rent, officials said, and was evicted in 2002 but continued to live there.

He presented himself as the landlord and illegally collected rent, according to prosecutors, and also filed a fraudulent deed to transfer ownership of the property to his name.

When a bank looked to foreclose the mortgage on the building in 2007, they listed McCray and the rightful owners as defendants.

He filed letters and motions to the court asserting his ownership of the property, but judges barred him from claiming interest in the property. Still, he continued to do so, the DA’s office said.

In January 2015 he filed a court order with a forged signature purporting to be that of Judge Lewis, giving him sole ownership of the building and ending the foreclosure action.

When he sold the building, he cashed two checks from the sale but returned to his lawyer’s office in July 2015 to pick another check for $16,000, and was subsequently arrested by officers from the Sheriff’s Department.

McCray was convicted of grand larceny and criminal possession of a forged instrument, among other charges, in September.

Along with his sentencing Wednesday, a judge ordered the removal of his fraudulent filings from the city’s Property Records repository.

“This significant prison sentence should serve as a warning to anyone who tries to take advantage of Brooklyn’s booming real estate market by conducting criminal schemes, like the brazen forgeries and theft in this case,” Acting DA Eric Gonzalez said in a statement.

Attorney information for McCray was not immediately available.