The family of astronaut Neil Armstrong was paid $6 million to settle allegations that his 2012 death resulted from poor treatment following heart-bypass surgery, the New York Times reported.

A Penn Medicine heart surgeon reviewed the case for the family and faulted the Ohio hospital where Armstrong was treated, the newspaper said, citing court documents that had been under seal.

Armstrong seemed to be doing well after the surgery, to the point that he was able to walk in the hallway at Mercy Health-Fairfield Hospital, in suburban Cincinnati, his wife told reporters shortly afterward.

But when nurses removed the wires leading to a temporary pacemaker, Armstrong began to bleed internally, the Times said. Rather than return the famed astronaut to surgery, hospital staff took him to the cardiac catheterization lab — a facility where physicians can insert a catheter to diagnose and treat certain heart conditions that do not require surgery.

That was not enough, Penn heart surgeon Joseph Bavaria wrote, according to the Times.

“The decision to go to the cath lab was THE major error,” he wrote.

A spokesperson for Penn Medicine said Wednesday that Bavaria was not available to comment on the case.

Bavaria also questioned whether Armstrong had even needed the bypass surgery on an emergency basis, according to the Cincinnati Enquirer. When Armstrong was admitted to the hospital with symptoms of heart disease, physicians told his family that bypass surgery should be done immediately, the Enquirer said.

“While Neil indeed had significant coronary disease, THERE WAS NO EMERGENCY here,” Bavaria wrote in a July 1, 2014, letter, the Ohio newspaper reported. “Neil’s death could have been avoided had the proper standard of care been provided.”

A spokesperson for the Ohio hospital defended its treatment of Armstrong, who was 82, adding that “the public nature of these details is very disappointing — both for our ministry and the patient’s family who had wished to keep this legal matter private,” according to the Enquirer.

The newspapers said they had received the court documents from anonymous sources this year, as the nation commemorated the 50th anniversary of Armstrong’s moon landing.

Heart-bypass surgery is sometimes performed when a patient suffers a blockage in a coronary artery — a major blood vessel that supplies the heart with oxygen. Surgeons create a pathway around the blockage by grafting on a blood vessel taken from elsewhere in the body.

Nearly all patients survive the surgery, government statistics show. Just 1% to 2% of patients die within 30 days of a typical bypass operation, though the rate is slightly higher when a valve procedure is included.

Increasingly, some patients opt instead to have stents implanted in a coronary artery.