Madison, WI (SportsNetwork.com) - Gary Andersen is leaving Wisconsin after two seasons to coach Oregon State.

Both schools announced the move Wednesday afternoon after Andersen told the Badgers football team of his decision.

He will take over for Mike Riley, who left Oregon State after 14 seasons to take the Nebraska job last week.

Andersen, 50, was 19-7 as coach of the Badgers with a loss to South Carolina in the Capital One Bowl in January.

They went 10-3 this season, winning the Big Ten's West Division before losing a 59-0 rout to Ohio State in Saturday's conference title game and landing a New Year's Day bowl game.

He will be formally introduced by Oregon State at a news conference on Friday afternoon.

"We have hired the right coach," Oregon State athletic director Bob De Carolis said in a statement. "We are investing in the new and expanded facilities he needs, including the $42 million makeover of the Valley Football Center we announced earlier today.

"We are ready to have Gary take us to the next level."

Before he was hired by Wisconsin in December 2012, Andersen went 26-24 in four seasons at Utah State with a 1-1 record at the Famous Idaho Potato Bowl. Prior to that, he was a longtime assistant coach, including a stint at Utah as the defensive coordinator and assistant head coach.

Wisconsin, which finished 18th in the College Football Playoff rankings, is due to play Auburn in the Outback Bowl on Jan. 1.

Barry Alvarez, the longtime Badgers coach who is now Wisconsin's athletic director, said he began working to find a new head coach as soon as Andersen said he was leaving.

"My first concern is taking care of the players on the current team, especially the senior class, and ensuring that their bowl experience is a memorable one," said Alvarez, who coached Wisconsin from 1990-2005.

Alvarez coached the Badgers in the Rose Bowl two seasons ago after Andersen was hired to replace Bret Bielema, who left for Arkansas. The Badgers lost the game to Stanford.

Riley spent 14 seasons at Oregon State, first from 1997-98 and then again from 2003-14 after spending three years coaching the NFL's San Diego Chargers. The Beavers went 93-80 under Riley, who took over at Nebraska after Bo Pelini was fired.

Oregon State went 5-7 this season, missing a bowl game for the first time in three years.