This union was a grave mistake.

A twisted Upper West Side woman allegedly secretly married her mentally ill landlord on his death bed so she could inherit his estate — and then boasted about it. 

Barbara Seidel, who rented a room at 574 West End Ave. from Albert Lerner for years, tied the knot with the “incapacitated” 78-year-old shortly before his Feb. 21 death, Albert’s older brother Stefan said in a lawsuit.

Seidel, 63, “not only bragged that she ‘married a dead man’ but also taunted [Stefan] by stating that her marriage with Albert put her ‘ahead’” in the will, he claimed in the Manhattan Supreme Court filing.

exterior of 574 west end aveA woman allegedly married her landlord while the older man was on his deathbed, according to a lawsuit. J.C. Rice

Albert Lerner suffered with delusions since he was a teenager, said his brother, who wants the union annulled.

“He believed that there was a monitoring device constantly observing [him], which in turn was being monitored by a gang in lower Manhattan,” Stefan Lerner said.

The isolated Albert, who once worked as a cabbie but received an inheritance from an aunt, only had regular contact with the people who sublet rooms in his large apartment in the 12-story building, where four and five bedroom pads rent for as much as $15,000 a month.

Lerner lived in a large, rent-controlled pad, “a huge apartment, about four or five bedrooms,” a source at the building told The Post.

Seidel was the last in a long line of caregivers, and would come each morning to care for Albert — but once he died, she began living in the unit, the source noted.

“He had been living here forever,” the source said. “He always lived alone. . . . He was quiet, a very nice man.

“When Albert was alive she came and left every day. She never stayed there. After he died she started staying there,” the source said.

“She married him a week before he died.”

stock image of a woman at a bedside crying, while a person in a white coat with a stethoscope pulls up a white sheetThe woman allegedly bragged about marrying a “dead man.” chokniti – stock.adobe.com

He received hospice care at Mount Sinai Morningside before his death there of heart failure. He suffered from “intense and unquenchable itching,” and struggled with a colostomy bag, his brother said in court papers. 

Albert and Seidel had “a completely platonic and non-romantic relationship” and never consummated the union, Stefan alleged.

She “coerced the mentally ill and physically frail Albert to sign a marriage license only a couple of days before his death,” he claimed.

As evidence of the sham marriage, Stefan pointed to a lawyer who allegedly returned a $2,500 retainer he’d collected from the pair “because he could not go along with ‘the marriage issue,’ ” according to court papers.

The lawyer, who was not identified, told Stefan the marriage “was clearly a ‘set-up’ to gain access to Albert’s funds as his ‘spouse,”” the suit claimed.

Annulling the marriage would make Stefan Lerner the sole heir of his brother’s estate, he said in court papers which did not specify how much was at stake.

Seidel did not return messages seeking comment.