BOSTON — David Ortiz has completed his retirement tour around the major leagues, collecting farewell tributes from the opponents who watched him dismantle yet another late-inning lead (or dugout telephone ).

The gift he received from his Boston teammates has been the best of all.

After two straight last-place finishes, the ballclub that Ortiz carried from cursed to first was determined to send him out as a winner. And with an AL East title getting him back to the playoffs, Boston’s beloved “Big Papi” has a chance to play for his fourth World Series ring — something only one Red Sox player in history has ever accomplished.

“It’s definitely one to write in the history books,” said Red Sox outfielder Mookie Betts, who has helped lead the team’s recovery and, like Ortiz, is a contender for the AL MVP award. “Somebody in their last year and they’re having a year like this is definitely amazing.”

It wasn’t that long ago that the Red Sox were a tormented franchise, with generations of Boston fans who came and went without seeing their team win it all. In 2003, Ortiz’s first season with the Red Sox, they added another chapter of woe with a Game 7 collapse against the New York Yankees in the AL Championship Series.

There was no reason to think it would be different when the teams played for a spot in the World Series again the next year — certainly not after the Yankees won the first three games. But with extra-inning walkoff hits in back-to-back games, Ortiz helped Boston become the first major league team to rally from a 3-0 deficit in a best-of-seven series.

The Red Sox went on to sweep the St. Louis Cardinals for their first World Series title in 86 years, and the members of that team became heroes in Boston.

Only Ortiz stuck around for two more rings.

The Red Sox won it again in 2007, but by 2013 they had gone three years without a postseason berth. Ortiz was the only member of the roster remaining from the cathartic ’04 title, and the logical choice to rally the city after the Boston Marathon bombings.

Taking the microphone on the Fenway mound for the first home game after the attacks, Ortiz proclaimed, “This is our (expletive) city. And nobody’s going to dictate our freedom.”

Then, buoyed by civic pride in the wake of the attacks, the Red Sox returned to the World Series.

And Ortiz had one left speech left in him.

Trailing St. Louis 2-1 in the Series and tied in Game 4, Ortiz gathered the Red Sox around him in the dugout and told them not to take the opportunity for granted.

“Any time this guy puts a uniform on, there’s a presence,” outfielder Jonny Gomes said afterward. “And that this guy wants to rally us together for a pep talk, it was like 24 kindergartners looking up at their teacher. He got everyone’s attention and we looked him right in the eyes, and that message was pretty powerful.”

The Red Sox won three straight to take the title in six games. Ortiz batted .688 to earn Series MVP honors. But that was followed by a pair of fifth-place finishes, seasons when the Red Sox weren’t even competitive.

On Nov. 18, 2015, his 40th birthday, Ortiz announced that he would only play one more year.

“Time is up,” he said in a video posted on The Players Tribune. “So let’s enjoy the season.”

For the Red Sox, the mission was obvious:

“If you’re a fan of the game of baseball; if you’re a fan of the Boston Red Sox or a player for the Boston Red Sox, it should be pretty apparent what he’s meant to this ballclub,” general manager Mike Hazen said over the winter. “Nobody wants to watch somebody like that finish up their career that way.”

Least of all Ortiz.

Far from showing his age, Ortiz had one of the best seasons of his career. He became the oldest player to hit 30 home runs. He already has more homers and RBIs in his final season than any player in baseball history.

Along the way he passed Ted Williams and Mickey Mantle on the career home run list, and Carl Yastrzemski and Lou Gehrig on the all-time extra-base hits list.

And on Wednesday night, Boston clinched its third AL East title since 1995. If Ortiz can win a fourth ring, he would be the first Red Sox player since Harry Hooper in 1918 to play in and win four Series.

“Being able to be in the playoffs right now is something very special,” Ortiz said during the celebration in Yankee Stadium. “It’s going to be my last one, so I’m going to enjoy it the best I can.”

AP freelancer Mark Didtler contributed to this story from St. Petersburg, Florida.