By GREG BEACHAM
AP Sports Writer

LOS ANGELES — After 20 years in a Lakers uniform and a lifetime in basketball, Kobe Bryant determined that his aching body and his passion for the game had both grown weaker than his excitement about the future.

That’s when Kobe decided he could only wait a few more months to begin his life after the Lakers.

Bryant announced Sunday that he will retire after this season, ending a landmark 20-year NBA career spent entirely with Los Angeles. He was serenaded with cheers throughout the struggling Lakers’ 107-103 loss to Indiana, beginning his farewell tour through the league with a clear mind and a burgeoning curiosity about his next chapter.

“I had to just accept the fact that I don’t want to do this anymore, and I’m OK with that,” the dry-eyed, smiling Bryant said after the game.

The 37-year-old Bryant made the long-anticipated declaration in a post on The Players’ Tribune on Sunday, writing a poem titled “Dear Basketball.”

“My heart can take the pounding. My mind can handle the grind. But my body knows it’s time to say goodbye,” wrote Bryant, the third-leading scorer in NBA history. “And that’s OK. I’m ready to let you go. I want you to know now. So we both can savor every moment we have left together. The good and the bad. We have given each other all that we have.”

When the Lakers hosted the Indiana Pacers on Sunday night, fans expecting an unremarkable regular-season game for the struggling home team instead received a letter from Bryant in a black envelope embossed with gold.

“What you’ve done for me is far greater than anything I’ve done for you,” Bryant wrote. “I knew that each minute of each game I wore purple and gold.”

The theatricality of Bryant’s announcement fit a dramatic career that has included five championship rings and 17 All-Star selections during two decades with the Lakers, giving him the longest tenure with one team in NBA history.

Bryant went straight from high school in suburban Philadelphia to his favorite childhood team in 1996. He became the top scorer in Lakers history with offensive creativity and resourceful athleticism that inspired the generation of fans and players who missed Michael Jordan’s peak, but grew up on the dynamic exploits of the Lakers’ latest superstar.

“Kobe was my Jordan,” said Southern California native Paul George, who scored 39 points for Indiana to beat the Lakers after Bryant missed a late 3-pointer to tie it. “Watching him win championships when I was growing up, that’s who I idolized. That was the standard.”

But Bryant’s last three seasons have ended early due to injuries, and he played in only 41 games over the previous two years. He has struggled mightily in the first 16 games of this season with mostly young teammates on a rebuilding roster, making a career-worst 32 percent of his shots and dealing with pain and exhaustion every day.

Yet to Bryant, the current state of his game is no tragedy.

“There’s so much beauty in the pain of this thing,” Bryant said. “It sounds really weird to say that, but I appreciate the really, really tough times as much as I appreciate the great times. It’s important to go through that progression, because I think that’s where you really learn about the self.”

In recent months, Bryant repeatedly said he didn’t know whether he would play another season, clearly hoping for a rebound in his health and the Lakers’ fortunes.

Neither has happened, and the ever-impatient Bryant didn’t wait any longer to decide his future.

“Kobe Bryant is one of the greatest players in the history of our game,” NBA Commissioner Adam Silver said. “Whether competing in the Finals or hoisting jump shots after midnight in an empty gym, Kobe has an unconditional love for the game.”

In a ritual likely to be repeated in arenas for the next 4 1/2 months, Bryant warmed up for Sunday’s game amid even more than the usual swarm of camera phones and flashes surrounding the court. Bryant then missed his first six shots, including three 3-pointers. His slump stretched to 2 for 17 before he hit two big shots late, including a last-minute 3-pointer before his final miss.

Bryant surprised Lakers coach Byron Scott with his decision Saturday night. Scott, Bryant’s teammate during the 1996-97 season, thought the star “had at least another year” in him.

Bryant disagreed, and he decided to make it public after talking with Jordan and other “muses.”

“If I had a burning desire to continue to play, I would,” Bryant said. “I wouldn’t be second-guessing. I wouldn’t be on the fence. I feel very solid in my decision.”

Even during his late-career struggles with the foundering Lakers, Bryant’s fans have remained devoted to the 6-foot-6 star who won titles alongside Shaquille O’Neal in 2000, 2001 and 2002 before teaming with Pau Gasol for two more in 2009 and 2010. Only 13 players in league history played on more championship teams than Bryant.

Even with the Lakers already likely to miss the playoffs for the third straight season – a first in franchise history – Bryant intends to keep going. The Lakers start an eight-game road trip Tuesday in Philadelphia, and he has already been saluted with cheers this season in savvy cities like New York and Miami where fans already realized it was probably his last stop.

“There’s nothing I would love more than to be able to play this entire season, to go through all of these tough times, to be able to suit up and play on the road in these buildings for the last time,” Bryant said.

Bryant is the NBA’s highest-paid player this season with a $25 million salary bestowed on him by grateful Lakers owner Jim Buss despite his recent injury problems, and he is keeping his vow never to play for another franchise.

But Bryant’s departure will allow the Lakers to split with the past while embracing a future with young prospects Julius Randle, D’Angelo Russell and Jordan Clarkson.

General manager Mitch Kupchak has spent his entire career building rosters around Bryant, but the executive acknowledged frustration with the Lakers’ incredible struggles in Bryant’s final two seasons.

“Clearly we’re not playing at the kind of level that a player of Kobe’s age and experience finds challenging, kind of like there’s no light at the end of the tunnel,” said Kupchak, who didn’t learn of Bryant’s decision until Sunday afternoon. “So I’m not surprised that he would make the announcement now. I think the game will be easier for him now. I think he’ll be able to enjoy the rest of the season.”

Bryant struck a philosophical tone in his first public comments since his decision, referencing the peace of mind created by his decision. He also spoke vaguely about plans for next year, but provided hints such as describing himself as “a storyteller” and explaining his conversations with Giorgio Armani about the fashion designer’s ability to build a global brand after turning 40 years old.

None of Bryant’s plans appear to have much to do with basketball _ although he allowed that it would be “an honor” to play for his third Olympic gold medal in Rio de Janeiro next summer if he is picked for the U.S. team.

“I don’t want to get too Zen-like,” Bryant said. “But honestly, when I’m sitting in meditation, my mind starts drifting, and it always drifted toward basketball, always. And it doesn’t do that now. It does that sometimes. It doesn’t do that all the time, and to me, that was really the first indicator that this game is not something I can obsess over for much longer.”