Coach Jim Harbaugh and the 49ers are parting ways after four seasons, which included three trips to the NFC Championship game and one Super Bowl appearance.

Harbaugh has accepted a job to become the next coach at the University of Michigan, sources confirmed Saturday evening to Comcast SportsNet Bay Area’s Dave Feldman.

The New York Times was first to report the official agreement.

Harbaugh and the 49ers are believed to have reached an agreement to allow Harbaugh to leave after four years of his five-year, $25 million contract. He is expected to be on the sideline Sunday when the 49ers finish their season against the Arizona Cardinals at Levi's Stadium.

Harbaugh is scheduled to be introduced at a press conference Tuesday in Ann Arbor, Michigan. Harbaugh played at Michigan under legendary coach Bo Schembechler from 1982-’86. Recent media reports have placed Harbaugh's contract at six years for as much as $49 million.

Harbaugh, an immensely popular figure for the 49ers’ fan base with his black “SF” fleece and khakis, leaves after returning the organization to prominence. When the 49ers hired Harbaugh in January 2011, the club had not made the playoffs for eight consecutive seasons.

[RELATED: Reports: Michigan reps in Bay Area in pursuit of Harbaugh]

It has been a foregone conclusion for most of the season that Harbaugh would not be back with the 49ers due to irreconcilable personality issues with CEO Jed York, general manager Trent Baalke and team president Paraag Marathe.

 

In four seasons as 49ers coach, Harbaugh’s teams posted a regular-season record of 43-19-1, entering the season finale Sunday.

“There are a lot of distractions around here -- a lot of distractions,” 49ers tight end Davis told CSNBayArea.com last week. “All season long there were a lot of distractions. But we tried our best to fight through them. Even now, there’s a lot of talk about Harbaugh not being here.”

Speculation that this would be Harbaugh’s final season surrounded the 49ers from the opening week of the season. Amid reports of the 49ers’ eventual parting of ways with Harbaugh, York offered a tepid response via Twitter on October 5, just prior to the home game against the Kansas City Chiefs.

York wrote: “Jim is my coach. We are trying to win a SB, not a personality or popularity contest. Any more questions?”

[RELATED: Jim Harbaugh Michigan gear already for sale]

A day later, York said any reports that the 49ers would fire Harbaugh after the season were “categorically not true,” during an interview on "The Rich Eisen Show.”

“We’re focused on getting back to and winning the Super Bowl,” York said. “That’s really the only thing that’s on anybody’s mind here. I’ve said this all along: I would like for nothing else to be in the worst negotiating position possible with Jim.”

But York did not offer any more football-related comments until the closing moments of the 49ers’ 19-3 loss to the Seattle Seahawks on Thanksgiving night.

“Thank you #49ersfaithful for coming out strong tonight. This performance wasn't acceptable. I apologize for that,” York wrote.

Harbaugh did not directly address York’s comment, but he made it clear exactly how he felt with York’s choice of words.

“It’s our job to move on without excuse, without apology and get it right. Make it right,” Harbaugh said.

But the 49ers could not get it right.

[RATTO: Harbaugh goes for comfort, what's next for coach?]

The loss on Thanksgiving was the beginning of the longest 49ers losing since Harbaugh became coach. After an embarrassing December 7 loss to the Oakland Raiders, who entered the game with just one victory, the 49ers officially fell out of playoff contention with a 17-7 loss at Seattle.

.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

Afterward, quarterback Colin Kaepernick said it was strange to hear the rampant talk about Harbaugh coaching his final season with the 49ers.

“That’s something I can’t fully wrap my mind around why that would be the situation,” Kaepernick said. “But he has my full support, no matter if he’s here or somewhere else. I hope he’s back here and I think he’s a great coach.”

 

Harbaugh came to the 49ers as the organization’s 18th head coach after a wildly successful run at Stanford, where he inherited a one-win team and turned the program around to become a national power.

"It's the perfect competitive challenge," Harbaugh said at his introductory press conference with the 49ers. "I look forward to coaching against John Harbaugh, Bill Belichick and the many great coaches in the NFL. That kind of challenge, I willingly accept it and I look very much forward to it."

Late in the 2012 season, Harbaugh’s 49ers defeated Belichick’s New England Patriots. And he met his brother, John Harbaugh, and the Baltimore Ravens in Super Bowl XLVII.

The 49ers rallied from a 28-6 deficit in the third quarter and stood 5 yards from a potential Super Bowl title before three consecutive incomplete passes sent the organization to its first loss in the NFL championship game.

The 49ers made it back to the playoffs in 2013, but were eliminated when Kaepernick’s pass toward Michael Crabtree end the end zone was tipped by Seattle cornerback Richard Sherman and intercepted by linebacker Malcolm Smith with 22 seconds remaining.

York and Harbaugh were unable to work out contract extensions after the past two seasons. Last year, when the Cleveland Browns contacted York about the possibility of swinging a trade for Harbaugh, York called Harbaugh to see if it was something Harbaugh wanted to pursue.

“He wasn’t in the office,” York told Bay Area reporters in March at the NFL owners meeting. “So I talked to him probably an hour after the Browns thing. I called. There was no answer. I texted and said, ‘Hey, give me a ring.’ He was at preschool with (his daughter). ‘Listen, I just want to ask you, was there any interest in your part? This is the phone call I got.’ “

Harbaugh called him back and said, according to York, “I don’t know what you’re talking about.”

“And that was the end of it,” York said.

The sides announced at the beginning of training camp that they would table contract talks until the end of the season – in essence, making this a make-or-break season. But the 49ers struggled on the field and off the field.

Tight end Vernon Davis and guard Alex Boone did not take part in the team’s offseason program due to contract issues, prompting Harbaugh to say, “(It’s) not the decision I envision being the 49er way.”

Defensive end Ray McDonald was arrested for alleged domestic violence before the 49ers’ first game. The organization cited “due process” while keeping McDonald active and playing during the investigation. When McDonald was investigated again as a suspect in an alleged sexual assault on Dec. 17, the 49ers released him later that day.

The 49ers experienced an injury-riddled season in which 18 players finished the year on injured reserve, including linebackers Patrick Willis, NaVorro Bowman and Chris Borland, and nose tackles Ian Williams and Glenn Dorsey, center Daniel Kilgore, tight end Vance McDonald, and first-round draft pick Jimmie Ward.

 

Harbaugh never talked about his other coaching options, which included the possibility he could remain in the NFL.

“What will happen, will happen,” Harbaugh said at his Monday press conference. “What won’t happen, won’t happen. I work at the pleasure of the organization and I will let them have the floor on that.”