"The NFL has been an amazing page in this chapter of my life," Williams said in a statement released by the University of Texas. "I pray that all successive adventures offer me the same potential for growth, success and most importantly fun. I want to thank all my fans, teammates, coaches and supporters for the strength they've given me to overcome so much."
Williams told WQAM in Miami on Tuesday that a text exchange with Bill Parcells, his former boss with the Miami Dolphins, prompted him to think about his future and ultimately led him to decide to retire.
According to the South Florida Sun-Sentinel, Parcells texted Williams to check up on him. Williams responded that he felt good and couldn't "wait till next year." Parcells' response to Williams' reply changed the running back's perspective, however.
"That's good. Don't chase this thing too long. You can contribute in other ways," Parcells wrote in his text, according to the newspaper.
Williams said Wednesday in an interview with ESPN Radio's "Mike and Mike in the Morning" that Parcells' text was "huge" in helping him to rethink his future.
"After I started to think about it I was very grateful to him for kind of releasing me, allowing me to let my mind expand to consider what else I could achieve."
Williams briefly retired once before, missing the 2004 season. He was facing a four-game suspension for violating the league's drug policy before he shockingly announced he was leaving the game. He returned in 2005, then left to spend the 2006 season with Toronto of the Canadian Football League.
On his Twitter account, Williams wrote: "Thank you all, but this ain't it, I'm gonna do something really special. 'Be you and change the world,' "
Since winning the Heisman Trophy at Texas and joining the New Orleans Saints in 1999, Williams has rushed for 10,009 yards and scored 74 touchdowns.
He is one of only 26 NFL running backs to rush for more than 10,000 yards in a career.
Then-Saints coach Mike Ditka traded all of his draft picks in 1999 and New Orleans' first- and third-round picks in 2000 to pick Williams fifth overall.
He has had five 1,000-yard seasons and served as a workhorse for both the Saints and Dolphins.
Williams led the NFL in 2002 with 1,853 yards rushing for the Miami Dolphins and received his lone Pro Bowl invitation that season. He backed that up with 1,372 yards in 2003, giving him what remains the two most productive rushing seasons in Dolphins history.
Now 34, Williams assumed a backup role with the Ravens last season. Playing behind Ray Rice, Williams gained 444 yards on 108 attempts and scored two touchdowns.
"I have to thank Coach (John) Harbaugh and the Ravens organization for the opportunity they gave me this year," Williams said in the statement. "I had so much fun and really appreciated the chance to finish on such a great note."
Williams fit in well with the Ravens and made a lasting impression on Rice, who led the NFL this season with 2,068 yards from scrimmage.
"I was a big fan of Ricky before we were teammates, but being around him this year is the best thing that happened to me in my NFL career," Rice said. "As a young player, you need to be around a guy who knows what he is doing, and Ricky was tremendous to learn from. The way he took care of his body and the way he prepared, he always showed that he is a true professional. This past season with him is a year I will never forget.
"I had the best year with him beside me, and that was no accident. I believe that Ricky Williams is a Hall of Famer. All that he has done in his career, he deserves that."
Harbaugh said during his time in Baltimore, Williams "made a valuable and lasting contribution. I especially enjoyed getting to know him as a person, and I have the utmost respect for him.
"He was great to be around and to work with every single day."
Information from The Associated Press was used in this report.