OAKLAND, Calif. -- Shaun Livingston's career nearly ended 12 years ago far ahead of his schedule because of a gruesome knee injury. Now, he gets to retire on his own terms -- and with three championships after playing a key role during the Golden State Warriors' recent title runs.

The 34-year-old Livingston announced his retirement on social media Friday following 15 NBA seasons, an anticipated move for the veteran guard. He reached the NBA Finals in each of his five seasons with Golden State, his ninth NBA team.

Livingston, who signed a $24 million, three-year contract in 2017 but was waived by the Warriors in July to cut salary costs, has discussed working in the front office with the team.

"After 15 years in the NBA, I'm excited, sad, fortunate and grateful all in one breath. Hard to put into a caption all of the emotions it takes to try and accomplish your dreams," Livingston shared in a post on his Instagram and Twitter accounts. "I wasn't supposed to be here. Anybody that has beat the odds understands the mental and emotional strain it takes to inspire yourself on an uphill war, let alone inspire others."

While with the Clippers on Feb. 26, 2007, Livingston's left leg buckled backward, parallel to the court, when he fell in a freak accident. He screamed and writhed in agony. Doctors thought the leg might have to be amputated.

Livingston tore three major ligaments in his knee -- the anterior cruciate, posterior cruciate and medial collateral -- as well as his lateral meniscus, then required extensive surgery performed by renowned orthopedist Dr. James Andrews in Birmingham, Alabama.

Livingston, who also dislocated his knee cap and tibiofemoral joint, overcame long medical odds just to get back on the court. He had to learn to walk again before he could even think of getting back on a basketball court or returning to playing at the highest level.

"The [injuries] gave me a chance to find and prove to myself [and the world] that I wouldn't be defined by my circumstances," Livingston said. "With my time in the league what I will be most proud of is the fact that my character, values and faith were tested, and I persevered."

His Warriors teammates admired him for his tireless work on the court, the way he stayed ready coming off the bench and the example he set for the other backups and younger players.

During the Warriors' 73-win 2016 season that ended with a Game 7 NBA Finals loss at home to LeBron James and the Cleveland Cavaliers, Livingston filled in beautifully for injured two-time MVP Stephen Curry.

He became only the second player in NBA history to spend at least five seasons with a team and make the NBA Finals each year. Tom Heinsohn accomplished the feat in nine straight seasons with the Celtics from 1956 to 1965.

The No. 4 overall draft pick by the Clippers in 2004 out of Peoria Central High in Illinois, Livingston averaged 6.3 points, 2.4 rebounds and 3.0 assists over 833 career games. He loved doing community work and taking part in Warriors camps, as well as inspiring kids back home in Peoria.

"Shaun Livingston's story is one of the most inspirational in the history of professional sports," Warriors general manager Bob Myers said. "What he accomplished after suffering so many trials and tribulations early in his career is a true testament to who he is as a person, which has always been characterized by tremendous class, grace and professionalism. He represents everything that you'd want in a professional athlete and, most importantly, in a human being. We appreciate what he did for our team and organization over the last five years, becoming a three-time NBA champion and a key figure on one of the best teams in NBA history. We wish him well as he begins the next phase in his life."