World Series champion and two-time All-Star Bobby Jenks agreed to a $5.1 million settlement from a Boston hospital and a doctor he said caused a career-ending spinal injury.

Jenks, 38, reached the out-of-court settlement with Massachusetts General Hospital and the doctor Wednesday, a day before his malpractice lawsuit was slated to begin, the Boston Globe reported.

ARIZONA DIAMONDBACKS' ARCHIE BRADLEY ELATED OVER ROYAL BABY, HOPES TO BE INVITED TO CHILD'S BIRTHDAY

Jenks said the surgery, which took place in 2011, was botched while the doctor was simultaneously overseeing another operation. The hospital defended the operation, saying the former pitcher received “high-quality and appropriate care” and that “overlapping surgery played no role in this case.”

Jenks was playing for the Boston Red Sox in 2011 when he left a game against the New York Yankees in pain. When doctors recommended surgery to reduce his pain, he went to the hospital and the doctor told him it would be a “quick and easy” operation, according to the Boston Globe. Lawyers for the doctor disputed the notion that the doctor told him he’d be able to return to baseball.

Two weeks after the operation, Jenks had suffered a tear in the dural sac and leaked spinal fluid, according to the newspaper. Lawyers on both sides disputed what happened next as the hospital argued Jenks failed to follow hospital discharge instructions, which called for him to call the doctor immediately, and Jenks’ lawyers claimed he did follow the rules.

Jenks said he didn’t learn the doctor was performing another surgery that overlapped with his until after the lawsuit was filed, according to the newspaper. Defense lawyers insisted that the doctor “performed the entirety of Jenks’ spinal surgery” and didn’t operate on another patient until he completed Jenks’ surgery.

Jenks played seven years in the majors with the Red Sox and Chicago White Sox. He was named an All-Star in 2006 and 2007 and helped the White Sox to a World Series in 2005.

“Never picking up a baseball again is absolutely devastating,” Jenks told the Boston Globe. “I was living my dream, and it was taken away from me.”

CLICK HERE TO GET THE FOX NEWS APP

He finished his career with 173 saves and a career 3.53 ERA.

The Associated Press contributed to this report.