SANTA CLARA, Calif. (AP) -- Jim Harbaugh is done as coach of the San Francisco 49ers.
Harbaugh said after a 20-17 victory against playoff-bound Arizona on Sunday that he is leaving the 49ers, but did not say if he was resigning or was fired.
Asked whether it was his choice to move on, he said, "You work at the pleasure of the organization, that's what we all do."
Harbaugh departs with one season remaining on the $25 million, five-year contract he signed in January 2011. He led the 49ers (8-8) to three NFC title games and one loss in the Super Bowl in his four seasons.
Harbaugh sprinted off the Levi's Stadium field for the final time, cradling the game ball and the players doused him with a celebratory ice bucket.
"Jim and I have come to the conclusion that it is in our mutual best interest to move in different directions," said 49ers CEO Jed York. "We thank Jim for bringing a tremendous competitive nature and a great passion for the game to the 49ers. He and his staff restored a winning culture that has been the standard for our franchise throughout its history."
Colin Kaepernick threw a go-ahead 3-yard touchdown pass to Bruce Miller late in the third quarter. Anquan Boldin caught a 76-yard TD pass and went over 1,000 yards receiving. Frank Gore ran for 144 yards on 25 carries to go over 1,000 yards rushing for the eighth time in 10 NFL seasons with San Francisco.
The franchise's all-time rushing leader hopes to return to the only team he has known and the team has publicly expressed a mutual interest.
Not so for Harbaugh, who would depart with one season remaining on the $25 million, five-year contract he signed in January 2011.
Harbaugh spoke briefly on the field to York before the game amid unconfirmed reports the coach is bound for alma mater Michigan. Harbaugh said "announcements" will be made.
San Francisco missed the playoffs following three straight trips to the NFC championship game and a runner-up Super Bowl finish after the 2012 season. The 49ers, plagued by injuries to key players all season, snapped a four-game losing streak, their first under Harbaugh
The Cardinals (11-5) missed the franchise's first 12-win season.
Ryan Lindley threw touchdown passes of 20 and 41 yards to Michael Floyd in the first half, but couldn't deliver late.
Floyd finished with eight catches for 153 yards. Coach Bruce Arians went with Lindley under center after he originally planned to start rookie Logan Thomas before changing his mind.
Lindley was intercepted three times.
The No. 5 seed Cardinals missed the division title, too, as defending Super Bowl champion Seattle beat St. Louis 20-6 to win the NFC West and the overall top seed. The Cardinals play at Carolina next weekend.
Lindley threw his first career touchdown pass on his 229th attempt with a 20-yard completion to Floyd on Arizona's opening drive.
Arians has been optimistic Drew Stanton will be back next week from a sprained right knee that got infected.
Boldin caught a 9-yard touchdown pass that was negated by rookie center Marcus Martin's chop block penalty. Alfonso Smith also had his short scoring run negated when Harbaugh called timeout. Then came Miller's TD catch.
Franchise rushing leader Gore provided a bright spot at $1.3 billion Levi's Stadium, where San Francisco finished 4-4. Gore, with his family in attendance and wearing his No. 21 jersey, became the 11th player in NFL history with eight 1,000-yard seasons and 20th player to reach 11,000 yards rushing.
Phil Dawson kicked a 53-yard field goal early in the second quarter, just clearing the crossbar, then also hit from 37 yards before halftime.
Boldin caught a 76-yard touchdown pass from Kaepernick, the second-longest TD catch of his career. Boldin became the fourth player in 49ers franchise history with multiple 1,000-yard receiving seasons, joining Jerry Rice (12), Terrell Owens (5) and John Taylor (2).