The deal will pay Rice $17 million in the first year and $25 million in the first two years, the sources said.

The Ravens had placed their franchise tag on Rice in March and the sides had until 4 p.m. ET on Monday to reach an agreement. Without a long-term deal, Rice would have had to play the 2012 season under the $7.749 million tender or sit out the season.

Rice’s contract expired after a season in which he amassed an NFL-best 2,068 yards from scrimmage and helped the Ravens advance to the AFC Championship Game.

Last September, Ravens defensive tackleÂ Haloti NgataÂ traded his franchise tag for a five-year, $61 million contract. Rice wanted to follow a similar path.

Soon after Baltimore’s loss to New England in the AFC title game, Rice said, “I’m not going to complain about the franchise tag, but I prefer the long-term. That’s what Baltimore, the city, the fans, would love to know — that Ray Rice is going to be here, not just one year, but for many years to come.”

Rice scored a franchise-record 15 touchdowns in 2011 to go with a career-best 1,364 yards rushing. He also led Baltimore with 76 catches (for 704 yards).