They thought they had lost their beloved brother for good, taking him off life support and painfully watching him die.

Then he showed up for a family barbecue.

In a shocking bungle, Chicago police misidentified a badly beaten and unconscious patient, leaving a family to mistakenly think he was their relative and remove him from life support, a new lawsuit charges.

The stricken kin only realized the mix-up when the man they thought they had watched die, Alfonso Bennett, strolled up to their home for a family party seven days later, according to court papers.

“He walked in the door, and his sisters were stunned,” said family lawyer Cannon Lambert.

Bennett’s kin had already “commenced making funeral arrangements … which included purchasing a burial plot, casket and home-going clothes. They also commenced work on an obituary,” court documents say.

The debacle began April 29 when Chicago police found a naked and badly bludgeoned man underneath a car in the city and rushed him to local Mercy Hospital.

Police later identified the facially disfigured victim as Bennett, who had been listed as missing, by using his mug shot from an unspecified crime, the suit says.

The hospital contacted Bennett’s sibling, Rosie Brooks, on May 13, and she and her two sisters rushed to his side.

But the women sensed something was amiss and “continually and repeatedly expressed their serious doubts about the identity of the man they were being told was their brother to nearly every medical provider,” the suit says.

Staffers told the sisters they were in denial because of grief and “needed to accept it,” according to the suit filed July 3 in Cook County Circuit Court.

As the patient’s health rapidly declined, Bennett’s family decided to take him off life support May 23, and he died.

Seven days later, a healthy Bennett showed up at his kin’s home after “an out-of-state excursion looking to barbecue with his family,” the suit says.

The astonished but overjoyed family notified Chicago police. The cops then fingerprinted the dead body and identified it as that of Elisha Brittman.

Chicago police spokeswoman Jessica Alvarez told The Post on Thursday, “In order to protect a person’s privacy, we will use fingerprinting as a last resort.”

Brittman’s family was heartbroken to learn that he had died without them at his side and has joined Bennett’s kin in suing the hospital and city for more than $50,000 alleging negligence, wrongful death and emotional distress. Mercy Hospital didn’t return a request for comment.

A similarly horrifying mix-up occurred in New York City earlier this year at St. Barnabas Hospital, according to a Bronx Supreme Court suit.

A Brooklyn woman grieved at her brain-damaged brother’s hospital bedside for nine days before consenting to pull the plug.

After he was taken off life support, she discovered that her real brother was in jail and she had sent a stranger to his death.