Mercedes has put an end to weeks of speculation by confirming Valtteri Bottas as Lewis Hamilton's teammate for the 2017 season.

When reigning world champion Nico Rosberg announced his retirement at the end of last year, he vacated one of the most sought-after seats on the Formula One grid. Bottas was immediately considered as a candidate for the position, but his 2017 contract with Williams meant Mercedes entered negotiations with the British team to release him for the upcoming season.

Williams coaxed Felipe Massa out of retirement to ensure it had a replacement for Bottas, freeing up the 27-year-old Finn to sign for Mercedes.

With just over two months before the first race of 2017, Mercedes made the news official on Monday once Massa's deal had also been announced.

"Sometimes in life, unexpected circumstances provide interesting opportunities," Mercedes boss Toto Wolff said. "Nico's decision in December was a big surprise - certainly a challenging situation for the team to handle. But weathering the storm makes you more resilient and we see this as another opportunity for the team to grow.

"Valtteri is a no-nonsense guy: down to earth, straightforward and very focused. Pretty Finnish, to be honest, and a great fit for us. He has an impressive track record in the junior categories and nine podiums in F1. But now it's time for the next level, to see how he can step up to challenge for race wins and for championships. We know that we are already behind the curve in terms of preparations for the new season, so we've got a busy programme to get him integrated into the team. One thing is for sure: as I know Valtteri, he will give it everything."

Bottas added: "It's very exciting times for me. I think it's going to take a while to understand that this is really happening. It's definitely another dream come true, to race in another team with such great history -- especially in the recent years, which have been so impressive. I'm really proud to become a part of that and grateful to everyone at Mercedes for trusting my skills and giving me this opportunity.

"I've had a really warm welcome so far. Of course, I have a lot more people to meet and new faces to remember. But initially everything has felt very good. I'm really impressed with the facilities and I'm looking forward to getting to know everyone better. My first experience with Mercedes power was in F3 back in 2009 and, of course, I know the Power Unit well from the last three years with Williams. But there are a lot of new things to learn with the car and also with how the team operates at the factory, in testing and at the races."

Bottas' has had close ties with Wolff since the Austrian invested in his career along with Mika Hakkinen and driver manager Didier Coton in 2008. He joined Williams as a test driver in 2010, when Wolff was part of the management team, before making his F1 debut at the start of the 2013 season.

In 2015 he was linked to Ferrari after scoring six podiums in 19 races for Williams the previous year, but ultimately the deal fell through as Ferrari opted to stick with Kimi Raikkonen. Bottas scored just one podium last year as Williams fell to fifth in the constructors' championship, but he still convincingly outperformed teammate Massa with a 17-4 head-to-head record in qualifying and a 32-point advantage in the drivers' standings.