Lewis Hamilton will drive for Mercedes for the next three years after confirmation that he will switch from McLaren for the 2013 season.

Hamilton has been linked with the team for some time and, despite it appearing that he might re-sign with McLaren, the 27-year-old has now put pen to paper on a contract to partner Nico Rosberg next year.

The 2008 title winner insisted that the decision to leave the team that has guided his career since he was just 13-years-old was to give him a fresh challenge for the future and he said his goal was to take the team to championship success.

"It is now time for me to take on a fresh challenge and I am very excited to begin a new chapter racing for the Mercedes AMG Petronas Formula One Team," he said. "Mercedes-Benz has such an incredible heritage in motorsport, along with a passion for winning which I share.

"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."

Hamilton is no stranger to Mercedes having driven Mercedes-powered machinery in F3 before making his way up to F1 and Mercedes motorsport boss Norbert Haug said the Briton was the ideal person to replace seven-time champion Michael Schumacher, whose future is now unclear.

"Mercedes-Benz has supported Lewis throughout his career, from karting, to Formula 3, to our successful partnership with McLaren," Haug said, "and it will be a very nice moment for all of us in the team to see him at the wheel of a works Silver Arrow next season, following in the tradition of British Mercedes-Benz Grand Prix drivers Sir Stirling Moss and Richard Seaman.

"Of course, it takes a great driver to replace such a legendary and successful one as Michael Schumacher. Over the past three years, Michael has been a great driver and an exemplary ambassador for Mercedes AMG Petronas. His experience has been an important factor in guiding the development of our team in Brackley and we extend our sincere thanks to Michael for his loyalty, team play and commitment.

"We will be working very hard together in order to achieve the best possible results in the remainder of the 2012 season."

Sergio Perez will replace Hamilton at McLaren after agreeing a multi-year deal to partner Jenson Button.