Mangini is the latest casualty in a staff overhaul that includes the offseason firing of one-year head coach Jim Tomsula and the subsequent hiring of ex-Philadelphia Eagles head coach Chip Kelly.
Mangini, who was promoted internally from tight ends coach last season and given a three-year contract, lasted only one season at the helm of a unit that ranked 29th in total defense in 2015. San Francisco stumbled to its worst season since 2007 with a 5-11 record.
Modkins, 45, joined the Lions as running backs coach in 2013 and was retained when Jim Caldwell took over the head-coaching job from Jim Schwartz.
The 49ers' defense experienced critical losses last offseason. Defensive tackle Justin Smith retired after 14 seasons, star middle linebacker Patrick Willis shockingly retired because of persistent feet problems and budding rookie linebacker Chris Borland retired after one season, citing concerns about his long-term health after a football career.
Though impact linebacker NaVorro Bowman was finally healthy after a long recovery from a gruesome knee injury, defensive backsPerrish Cox and Chris Culliver and linebacker Dan Skutawere poached in free agency.
Compounding the attrition was the continued legal trouble of All-Pro pass-rusherAldon Smith, who faced misdemeanor charges of hit-and-run, drunken driving and vandalism stemming from an alleged Aug. 6 incident. Smith was cut by the 49ers on Aug. 7, signed with theOakland Raidersin September, then was suspended by the NFL for one year for his involvement in the alleged incident.
Mangini has twice been a head coach, with the New York Jets from 2006 through '08, and the Cleveland Browns in 2009 and '10. He also served as Bill Belichick's defensive coordinator with the Patriots in 2005 after serving on New England's staff since 2000.
On Thursday, the 49ers offeredHouston Texanslinebackers coach Mike Vrabel the defensive coordinator job, which Vrabel turned down, according to multiple media reports.
Texans coach Bill O'Brien and general manager Rick Smith worked hard behind the scenes to keep Vrabel and will give him a new contract, the Houston Chronicle reported, citing sources.
ESPN's Dianna Russini contributed to this report.
49ers fire Mangini, add Modkins as OC
ESPN 49ers reporter Paul Gutierrez discusses the firing of Eric Mangini and the hiring of former Lions RB coach Curtis Modkins as the team's new offensive coordinator.