Published: Jul 16, 2012 5:03 PM EDT
Updated: Jul 17, 2012 6:31 AM EDT

OWINGS MILLS, Md. (AP) - The Baltimore Ravens and Ray Rice agreed on a new five-year contract Monday worth roughly $40 million.

The Ravens and their standout running back went right down to the 4 p.m. deadline before hammering out the deal. Had Rice not signed, he would have played the 2012 season under the $7.7 million franchise tag tender.

Instead, he will get $17 million this year and $8 million in 2013.

Baltimore has made the playoffs in each of Rice's four seasons, twice advancing to the AFC title game. He earned his second Pro Bowl invite last year after leading the NFL with 2,068 yards from scrimmage.

"This is another example of (owner) Steve Bisciotti's commitment to the team and to our fans to retain our core players," Ravens general manager Ozzie Newsome said. "Ray has been an integral part of us earning the playoffs in each of his four seasons. His production on the field speaks for itself, and his leadership in the locker room is outstanding.

"I should say something about his community efforts; I think they are almost unmatched by any player in the NFL," Newsome said. "You'd have a hard time finding a player who does more or is as serious about helping others as Ray is. He is one of those players you can proudly say, 'He's on our team.' "

As Baltimore's franchise player, Rice would not have been required to report at the start of training camp. The Ravens will hold their first full squad workout July 26, and Rice is expected to attend.

Baltimore selected the 5-foot-8, 212-pounder from Rutgers in the second round of the 2008 draft. In 61 career games, he ranks second in franchise history in yards rushing (4,377) and yards from scrimmage (6,612).