Laura Cavanaugh/Getty Images

After taking two years off to ponder his future, Ray Allen is walking away from the game for good. The NBA's all-time leader in three-pointers announced his retirement Tuesday, capping a career that spanned four teams over 18 seasons.

Allen made the announcement in an open letter to his younger self for the Players' Tribune: "I write this to you today as a 41-year-old man who is retiring from the game. I write to you as a man who is completely at peace with himself."

NBA commissioner Adam Silver released a statement on Allen's decision:

The future Hall of Famer last played for the Miami Heat in 2013-14. Despite interest from a number of contenders, Allen announced in March that he would sit out last season and give himself a chance to re-evaluate his career over the summer.

He is eligible to be inducted into the Hall of Fame in 2019, as he has not played since 2014, per Scott Howard-Cooper of NBA.com.

Allen's representatives reportedly contacted the defending NBA champion Cleveland Cavaliers in July, according to Chris Haynes of Cleveland.com, but they never struck a deal.

Allen finishes his career with 24,505 points, good for 22nd on the league's all-time list. Former teammate LeBron James, who attempted to recruit Allen to Cleveland last season, passed him on that list last year.

Video Play Button Videos you might like

"He's one of my best friends," James told reporters. "He's a guy I competed against and grew up watching, and to be able to team with him the last two years when I was with Miami, I learned so much from him. To know I passed him, it's very humbling."

Allen has 413 more three-pointers than anyone in league history, a record that will probably stand for another decade or so while Stephen Curry chases it down. He is also among the 25 best players in NBA history in value over replacement (58.1), win shares (145.8) and free-throw percentage (89.4 percent), per Basketball-Reference.com.

Many credit the former UConn star with being the greatest shooter to step on an NBA floor. His game-tying three-pointer in Game 6 of the 2013 NBA Finals against San Antonio, which is viewed among the most clutch shots in league history, helped cement that legacy.

Overall, Allen made 10 All-Star appearances, made two All-NBA teams and won an Olympic gold medal as part of the 2000 United States national team in Sydney. He spent parts of seven seasons with the Milwaukee Bucks, five with the Boston Celtics, parts of five with the Seattle SuperSonics and two with the Miami Heat.

A majority of Allen's individual heights came with Milwaukee and Seattle, but his late-career brilliance in Boston and Miami helped him hoist the Larry O'Brien Trophy twice.

With a career average of 18.9 points per game and a career shooting percentage of 40.0 percent from beyond the arc, Allen was one of the best offensive players of his era, and he left an indelible mark on the game.

Follow Tyler Conway (@jtylerconway) on Twitter.