Hamlin, who was released by the Cowboys in April, worked out for Ravens this month.
"The idea is to build for a championship," Hamlin said. "I think [the Ravens] have done a great job of being in the running to be one of those teams competing for a championship for years. The additions that they made this offseason show they want to go an extra step further.
"That's important for them, and it was important for me to be a part of this team."
Hamlin finished with 74 tackles, no interceptions and four pass breakups in 2009. His 2010 base salary was scheduled to be $5.596 million before he was released.
Hamlin signed a one-year contract with the Cowboys in 2007 after spending four seasons in Seattle. Hamlin earned his first Pro Bowl berth that season, compiling career highs in tackles (102) and interceptions (five). The Cowboys rewarded Hamlin with a six-year, $39 million contract.
But Hamlin's numbers declined in 2008, when he had 92 tackles and just one interception. Last season, he missed four games with a high ankle sprain and was replaced by Alan Ball. At the time, Cowboys coach Wade Phillips praised Ball's work for getting the secondary in place and for making plays.
Hamlin returned for the final three games of the regular season and had 15 tackles and one pass breakup. Phillips said Hamlin was playing better toward the end of the season.
"I enjoyed the time that I was there," Hamlin said of Dallas. "I definitely had fun. I enjoyed the fans, I enjoyed the team, and I enjoyed my teammates. That's one thing in this business: You can't really get too comfortable because it's always business decisions being made out there. You can't lose respect for the team or the players from that, because I loved being there."
Information from ESPN NFL Insider Adam Schefter, ESPNDallas.com's Calvin Watkins and ESPN.com's James Walker was used in this report.