ABU DHABI, United Arab Emirates (AP) — In a widely expected shake-up, four-time Formula One champion Sebastian Vettel will replace two-time champion Fernando Alonso at Ferrari next season.

The 27-year-old German will be leaving Red Bull for the Italian team on a three-year deal, Ferrari said Thursday.

"The dream of a lifetime has come true. When I was a kid, Michael Schumacher in the red car was my greatest idol and now it's an incredible honor to finally get the chance to drive a Ferrari," Vettel said. "I am extremely motivated to help the team get back to the top."

Alonso, a 33-year-old Spaniard who won his two titles with Renault in 2006 and '06, had said earlier this season that his future was elsewhere. His destination remains unclear, but he is expected to join McLaren.

With Alonso sitting beside him Thursday, Vettel heaped praise on his new team.

"I think it will be a special journey, not even the first race but even winter testing," Vettel said. "To step into the car, I think it will remain with you for the rest of your life."

Alonso expressed his frustration with Ferarri last year after the Hungarian Grand Prix. That earned him a public rebuke from the team and led to rumors that he was on his way out.

In five seasons with Ferrari, Alonso finished runner-up to Vettel three times, including in 2012 and 2013. He pushed Vettel two years ago — finishing three points behind — but in last year's championship Vettel beat him by 155 points.

Even the prospect of a new deal at Ferrari couldn't change Alonso's mind.

"I felt it was the time to find new projects and motivation. I was in talks even last year to be honest," Alonso said. "This year I felt around summertime, September, that it was time to move."

Alonso, who won 11 races for Ferrari and secured 44 podium places, thanked the team for not standing in his way.

"They could say, 'No,' but this is a true sign of love and respect from this team," Alonso said. "From Monday (onward) I will be a true Ferrari supporter."

His final race will be on Sunday at the Abu Dhabi Grand Prix. He is fifth in the overall standings and has managed only two podium places this season. His last win was at the Spanish GP last May.

"We offer him our heartfelt thanks for what has been an extraordinary adventure with the Scuderia," Ferrari team principal Marco Mattiacci said.

Alonso entered the final race in Abu Dhabi four years ago with an eight-point lead. But Vettel won the first of his four straight titles with Red Bull that year.

Alonso drove alongside Brazilian driver Felipe Massa for four seasons, but they struggled to match Red Bull's speed. Things got worse this season — both for Alonso alongside Finnish driver Kimi Raikkonen, and for Vettel alongside Australian driver Daniel Ricciardo — with Mercedes winning 15 of 18 races so far and taking pole position in 17.

The 27-year-old Vettel's fall from the pinnacle of the sport was as spectacular as it was unexpected.

After winning 13 races last season — including the last nine — Vettel has won zero races this year while being upstaged by Ricciardo, who has won three. Vettel has been on the podium only four times and is fourth overall, two points ahead of Alonso and 55 behind Ricciardo.

Vettel's arrival at Ferrari has an added advantage. He is good friends with the 35-year-old Raikkonen, the 2007 F1 champion with Ferrari.

"On a personal level, (he's) very straightforward," Vettel said of his future teammate. "We have a great respect for each other."

McLaren's seats are currently taken by former champion Jenson Button and promising driver Kevin Magnussen of Denmark.

Sunday's race could be Button's last.

"When you're in Formula One for so many years, 15 years, this is your life," the 34-year-old British driver said. "But when you are put in an uncomfortable situation your eyes are open to different possibilities and there are a lot of challenges out there."