Josh McDaniels and the New England Patriots have agreed to a deal that will make McDaniels the team's offensive coordinator in 2012, according to a league source.
The Patriots announced Sunday night that McDaniels has been hired as an offensive assistant coach for the rest of this season.
McDaniels will replace Bill O'Brien, the new head coach at Penn State. O'Brien will work as the Patriots' offensive coordinator for the remainder of this season.
McDaniels is returning to the team he left in 2009, when he took the Broncos' head coaching job.
The Patriots will face the Broncos in the divisional playoffs Saturday night at Foxborough, Mass.
"There's no way I can stand up in front of our football team and talk about loyalty and commitment and then leave the Patriots at the start of a playoff run," O'Brien said at his introductory news conference at Penn State. "I have committed to the New England Patriots to see them through this playoff run. There's not going to be a lot of sleep over the next two-to-three weeks. Any break I have, to make sure I have as much time as I can for Penn State."
McDaniels is going from worst to first overnight, leaving the Rams and being a part of the Patriots team preparing for next weekend's divisional playoff game.
He was offensive coordinator with the Patriots from 2006-08 before becoming going to Denver. He was fired with a 3-9 record in 2010 after losing 17 of his last 22 games. The Patriots, who had a bye this weekend, go into the playoffs with an eight-game winning streak.
The 35-year-old McDaniels was the only Rams assistant under contract through next season when Steve Spagnuolo was fired on Jan. 2.
"I'm sure Josh will have opportunities around the NFL to possibly be a coordinator or better throughout this process," Kevin Demoff, the Rams vice president and chief operating officer, said at the time. "It's going to be fluid, but we'll figure out what's best for both parties."
The Rams scored the fewest points per game in the league, 12.1, gained the second fewest yards, 283.6, and the third fewest yards passing, 179.4. Sam Bradford struggled at quarterback with just six touchdown passes and six interceptions in McDaniels' system, which had many more longer developing pass plays than the Rams had in 2010 under Pat Shurmur.
That lack of production contrasts sharply with the Patriots offense under McDaniels, especially in 2007 when they went 16-0 and then won two playoff games before losing the Super Bowl to the New York Giants 17-14.
In that season, Tom Brady set a single-season league record with 50 touchdown passes for an offense that averaged a league-best 411.2 yards. It also was first in yards passing, 295.7 and points per game, 36.8.
Now McDaniels will be reunited with Brady and another prolific offense in time for the Patriots practices for their divisional playoff game. As the top-seeded team in the AFC, they earned home-field advantage throughout the conference playoffs.
The Patriots were second in the league in overall yards with 428 per game and yards passing with 317.8. Their average of 32.1 points was third.
Adam Schefter is ESPN's NFL Insider. Information from The Associated Press was used in this report.