Kobe Bryant, who has helped the Lakers win five NBA championships over a 20-year career spent entirely in Los Angeles, announced Sunday on The Players' Tribune website that he will retire after this season, writing that "this season is all I have left to give."

In a first-person story titled "Dear Basketball," the 37-year-old wrote in the form of a poem that the sport "gave a six-year-old boy his Laker dream/And I'll always love you for it."

"But I can't love you obsessively for much longer," Bryant wrote. "This season is all I have left to give. My heart can take the pounding. My mind can handle the grind but my body knows it's time to say goodbye.

"And that's OK. I'm ready to let you go."

Bryant addressed the media after Sunday's 107-103 loss to the Indiana Pacers, saying that he made his decision "a while" ago.

"I've known for a while," Bryant said. "A decision like this, you can't make that decision based on outside circumstances. It has to be an internal decision, and finally I've decided to accept that I can't actually do this anymore, and I'm OK with that.

"It takes a weight off my shoulders and everybody else's."

Lakers coach Byron Scott, speaking before Sunday's game, emphasized that the star guard's "purpose is to finish out this season and play."

"I think he still loves this game," Scott told reporters. "He still has a passion for it. He's still a competitive young man."

Elite Company Kobe Bryant is one of just four players in NBA history with 25,000 points, 6,000 rebounds and 6,000 assists in his career: Points Kobe Bryant 32,683 Oscar Robertson 26,710 John Havlicek 26,395 LeBron James 25,349

Bryant scored 13 points on 4-of-20 shooting as the Lakers dropped the 107-103 decision for their sixth consecutive loss.

Scott said he was "shocked" when Bryant informed him Saturday night that he was going to announce his retirement the following day.

"He kind of shocked me when he told me," Scott said. "[I'm] just sad more than anything. Just sad more than anything. Somebody who I truly care about, have a lot of respect for. I think it's always hard when greatness like Kobe decides to hang it up."

Bryant's decision is not totally unexpected, given that he has said many times in recent weeks that he has considered making this season his last. After two decades, two Olympic gold medals, five championship rings, 17 All-Star selections, an 81-point game that ranks as the second-best in NBA history and more than 32,000 points, Bryant's career is officially winding down.

"With 17 NBA All-Star selections, an NBA MVP, five NBA championships with the Lakers, two Olympic gold medals and a relentless work ethic, Kobe Bryant is one of the greatest players in the history of our game," NBA commissioner Adam Silver said in a statement. "Whether competing in the Finals or hoisting jump shots after midnight in an empty gym, Kobe has an unconditional love for the game.

Kobe Bryant, who has missed 123 games over the past two seasons due to injury, announced Sunday that he will retire after this season, writing, "This season is all I have left to give." Thearon W. Henderson/Getty Images

"I join Kobe's millions of fans around the world in congratulating him on an outstanding NBA career and thank him for so many thrilling memories."

Fans arriving at Staples Center on Sunday received a letter from Bryant in a black envelope embossed with gold.

Kobe's retirement announcement that's being distributed to fans at the door tonight: pic.twitter.com/JQbqwRXdj5 — Baxter Holmes (@BaxterHolmes) November 30, 2015

"What you've done for me is far greater than anything I've done for you," Bryant wrote in the letter to fans. "I knew that each minute of each game I wore purple and gold. I honor it as I play today and for the rest of this season. My love for this city, this team and for each of you will never fade. Thank you for this incredible journey."

This season has been a struggle for Bryant, whose young and rebuilding Lakers are mired at the bottom of the Western Conference standings; he's also shooting a career-worst 31.5 percent. Injuries have dogged him in recent years as well, limiting him to 41 of a possible 164 games the previous two seasons. Bryant is averaging more field goal attempts per game this season (a team-high 16.7) than points (15.7). His field goal percentage and 3-point percentage both rank last in the NBA among qualified players.

Yet despite the rough start to the season, the Lakers have publicly supported Bryant. Scott, who told ESPN on Friday that he would not bench Bryant for his poor play, said Sunday that Bryant seemed calm when informing him of his decision.

"It was so matter-of-fact and it was so at peace, which, after I thought about it, I felt better about that," Scott said. "It wasn't like he was agonizing over it or anything. He was just like, 'Yeah, I'm announcing I'm retiring.' He just kind of went on from there."

Lakers co-owner and executive vice president of basketball operations Jim Buss spoke to ESPN of his reaction to Bryant's disclosure.

"When he called me this afternoon and told me and it became a reality, it hurt. Kobe Bryant is family. He's been on this team for 20 years. That's more than half of the time our family has owned the Lakers."

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."

The Lakers have 66 games remaining after Sunday, and the remainder of the season will likely turn into an adoration tour of sorts for Bryant, who has already received long ovations from normally hostile fans on road trips this season, particularly in places such as New York and Miami, where crowds sensed they might be seeing him as an opponent for the final time.

The Lakers' next road game -- perhaps not coincidentally, given the timing of Bryant's announcement -- is on Tuesday in Philadelphia, Bryant's hometown.

Bryant is in the final year of a two-year deal that will pay him $25 million in 2015-16 and makes him the NBA's highest-paid player this season. The expiring contract and numerous injuries had led to widespread speculation that Bryant would retire after this season.

Bryant remains in contention for a spot on Team USA's 12-man roster for the 2016 Olympic Games in Rio, USA Basketball chairman Jerry Colangelo told ESPN's Marc Stein. Colangelo said Bryant's announcement "doesn't have any bearing" on the star guard's status for the Rio Games.

"We have this whole season to look at all of our players," Colangelo said Sunday.

Even before he publicly confirmed this season will be his last, Bryant said earlier this month that playing in Rio, which would give him an opportunity to win a third gold medal after triumphs in Beijing in 2008 and London in 2012, has great appeal to him.

"It would mean the world to me to be around those guys," Bryant told The Associated Press earlier this month.

Bryant was drafted out of high school by the Charlotte Hornets with the 13th overall pick in 1996, then was traded to the Lakers. He helped Los Angeles win NBA titles in 2000, 2001, 2002, 2009 and 2010 and was named the league's MVP in 2008. He currently is third on the NBA's all-time scoring list, behind only Kareem Abdul-Jabbar and Karl Malone.

Bryant won the dunk contest at All-Star Weekend as a rookie and played in the All-Star Game for the first time the following year, and a star was quickly born. The 81 points he scored against Toronto on Jan. 22, 2006, are second only to Wilt Chamberlain's 100-point game in NBA history, and Bryant is the only NBA player to spend 20 consecutive seasons with one team.

ESPN.com's Baxter Holmes, Marc Stein and Ramona Shelburne and The Associated Press contributed to this report.