The Baltimore Ravens have reached an agreement in principle with former Oakland Raiders free-agent safety Michael Huff on a three-year deal, the team announced Wednesday.

The contract is worth $6 million, a league source told ESPN NFL Insider Adam Schefter.

Baltimore needed to address the safety position after the team parted ways with both starters in the Super Bowl, Ed Reed (who signed with the Houston Texans) and Bernard Pollard (who was released, then signed with the Tennessee Titans). Huff, 29, has spent his entire career with the Raiders after being selected in the first round (seventh overall) of the 2006 NFL draft.

In eight seasons, Huff has 11 interceptions and 57 passes defensed. He also has recorded 5.5 sacks, four forced fumbles and one fumble recovery.

Huff was released by the Raiders on March 12 before he was to receive a $4 million roster bonus. He had visited the Dallas Cowboys earlier in the week before reaching a deal with the Ravens.

This is the Ravens' second addition to the defense this week. Baltimore officially signed Pro Bowl linebacker Elvis Dumervil on Tuesday.

The base value of Dumervil's deal is $26 million, including a $7.5 signing bonus for 2013. The contract could be worth as much as $35 million if incentives are reached, according to sources.

The contract has a $3.5 million option bonus in 2014.

Over the first three years of the contract, Dumervil will receive $17 million from Baltimore. The team has him for cap numbers of $2.5 million and $3.375 million in the first two years of the deal.

ESPN NFL Insider Adam Schefter and ESPN.com senior writer John Clayton contributed to this report.