Kevin Garnett seriously considered retirement before reaching agreement with the Boston Celtics on a three-year contract.

Instead of rebuilding, the Celtics decided to retool to remain a contender.

“I did give it some real thought,” he said. “With free agency coming up, I obviously didn’t want to think about another team or nothing like that. My retirement would have been a personal decision based on family or any other reasons I had.

“But my No. 1 reason for coming back was Doc, the guys, the city, the fans. I don’t know how Danny [Ainge] talked me into three years, but I’m enjoying my journey here.”

Because the Celtics advanced to Game 7 of the Eastern Conference Finals, Ainge had very little time to consider the direction of the roster moving forward.

“I was open to anything, but I was prepared for a lot,” said Ainge, the team’s president of basketball operations. “But ultimately when we went through all of the different possibilities and options that we had, the best option for us was to try to get KG, Jeff [Green], Brandon [Bass], and Ray back. And that’s what we set out to do.”

Garnett told Ainge and Rivers that he would make a decision by July 1.

“What made it a little bit easier for us was KG was the main piece,” Ainge said. “For a lot of reasons, but the replacement possibilities for KG were slim. We felt like that was big. If we get KG back, we have a chance of still being a good team.”

“When he signed a three-year contract, I felt like that guaranteed me another two years with the Celtics,” said Pierce. “There’s a domino effect in everything that goes on. If KG doesn’t sign, Ray signs with Miami, they probably look to trade me.”

“KG was the key — not to say KG is more important than other players on our team — but there just aren’t big guys that are as good as KG,” Ainge said. “The replacement of KG is tough and we’re grateful that he wanted to come back and play.

“I think a lot did hinge on KG. We have some good young players but, yeah, we probably would not have been a contender had KG chosen to retire.”