Sabrina B.

The Baltimore Ravens and franchised running back Ray Rice have agreed to terms on a five-year, $40 million contract, only minutes before Monday’s deadline, league sources told ESPN NFL Insider Adam Schefter.

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.

The Chicago Bears also signed their franchise player, running back Matt Forte, to a four-year deal earlier Monday. A source told Schefter that deal is worth roughly $32 million.

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).

-ESPN