Lewis Hamilton is to replace Michael Schumacher at Mercedes next season, the Formula One firm announced on Friday, bringing to an end months of speculation about the Briton's future at McLaren.
McLaren first announced that Sauber's Mexican driver Sergio Perez would replace Hamilton in 2013, before Mercedes said that seven-time world champion Schumacher would make way for the 27-year-old, who won the 2008 title.
Speculation has been rife for months about a possible Hamilton move away from the team that he has represented for 15 years, amid apparent wranglings over his salary and outspoken comments from the driver himself on pit stops and team tactics.
Hamilton, currently in fourth in the drivers' championship, has won three races this season, in Canada, Hungary and Italy, and finished on the podium in the opening three races in Australia, Malaysia and China.
He had been set to win another on the skyscraper-dotted street circuit of Singapore last weekend after starting in pole position, before a gearbox failure put him out of the running and forced his retirement.
None of the parties made reference to the contractual wranglings in their separate statements, although Hamilton described the move as a "fresh challenge".
"Together, we can grow and rise to this new challenge. I believe that I can help steer the Silver Arrows to the top and achieve our joint ambitions of winning the world championships," he added.
Hamilton will drive alongside his old friend and rival from their karting days, Nico Rosberg, next season and Mercedes team principal Ross Brawn said he was thrilled at the prospect, amid tributes to Schumacher and his contribution to the team.
"I believe that the combination of Lewis and Nico will be the most dynamic and exciting pairing on the grid next year and I am looking forward to what we can achieve together," he added.
Schumacher, who last won the world championships in 2004 for Ferrari and joined Mercedes in 2010, said he wished Hamilton well, vowing to concentrate on the remaining races in the current season. There was no immediate word on his future.
McLaren team principal Martin Whitmarsh has had to fend off repeated questions about Hamilton's future throughout the season amid a reported cooling of relations with team-mate Jenson Button and troubles in his private life.
Button criticised him after he tweeted sensitive team information during the Belgian Grand Prix. His muted victory celebrations in Italy were widely noted, despite his insistence that he was happy at McLaren.
Whitmarsh admitted last week that other teams would be queuing up to secure Hamilton's services but he described any suggestion the driver had already signed a deal with front-runner Mercedes as "fantasy".
On Friday, he only thanked Hamilton for his contribution to the team.
"He wrote a huge chapter of his life and career with us, and was, and always will be, a fine member of an exclusive club: the McLaren world champions' club," he added.
"It goes without saying that we all wish him well for the future, just as it also goes without saying that we hope and believe that Sergio, too, will become a member of that exclusive club before too long."
McLaren said it had signed a multi-year deal with 22-year-old Perez, adding that that pairing him with Button, 32, would be a "perfect blend of youth and experience".
Perez said he was "thrilled and delighted" to join McLaren.
"I'm under no illusion that it is indeed a very big step -- as it would be for any driver -- but I'm ready for it," he said.
"I am, and always will be, extremely grateful to Peter (Sauber) and everybody at the Sauber Formula 1 team for their belief in me, and for giving me the chance to race in Formula 1."