A terrible error of judgement by his Mercedes team cost Lewis Hamilton victory at the Monaco Grand Prix and handed it gift-wrapped to his team-mate and rival Nico Rosberg.

A win was all but assured for the reigning Formula One world champion as the race came to a close only for Hamilton's race engineers to choose to pit under the safety car allowing Rosberg and Sebastian Vettel to pass.

It saw Hamilton blow what would have been a second success on the streets of Monte Carlo and allowed Rosberg to secure a bonus third successive win at the Circuit de Monaco as Vettel's Ferrari followed home second.

The end of the race was as astonishing as it was galling for Hamilton, with this memorable week closing in the most gut-wrenching of ways.

Fresh from penning a lucrative, three-year extension with Mercedes, the 30-year-old dominated practice on Thursday and secured his first Monaco pole on Saturday.

It was a position Hamilton looked set to capitalise on, just like 10 of the last 11 drivers starting in pole have done in Monte Carlo.

However, the incomprehensible decision to pit after the safety car was brought out following Toro Rosso driver Max Verstappen's late crash cost the Briton a fourth win of the season.

Hamilton admitted it was "impossible to overtake" and peg back the two ahead of him, allowing Rosberg to secure back-to-back wins for the first time in his career.

"I am very, very happy, of course, but I know there was a lot of luck today," the Mercedes driver said.

"Lewis drove brilliantly and he would have also deserved the win, for sure, but that's the way it is in racing.

"I am definitely extremely happy and going to make the most of it."

Hamilton was understandably downbeat on the podium, but attempted to keep a lid on his emotions.

"Yeah, it was not the easiest of races," he said. "The team has done amazing all year long and we win and lose together.

"I am just grateful for the job they did and congratulations to Nico and Sebastian."

Asked why his car was brought in, he said: "I am sure we will sit down afterwards and try and think of ways we can improve."

Hamilton then pledged to "come back and win the next one" - a dignified response with emotions clearly running high after a crazy end to an otherwise run-of-the-mill race.

The championship leader got off well enough and Rosberg only just managed to hold off Vettel's Ferrari at turn one.

The first contact of the afternoon on the narrow streets of Monaco soon followed, with McLaren's Fernando Alonso clipping Nico Hulkenberg of Force India, incurring a five-second penalty as a result.

It was a not a race-ending collision but Lotus' Pastor Maldonado did not last much longer - retiring with a brake issue after lap eight.

At the front of the pack Hamilton was not holding back and, despite a few brake problems, responded impressively to calls to build up a bigger gap over Vettel, who was proving a nuisance for Rosberg.

The Mercedes driver staved off the threat of being undercut by the Ferrari after pitting, with Hamilton following him in at the halfway point.

It was a clean stop and one which seemingly took any pressure off the Briton, whose lead grew as the second half of the race continued.

Things were not so enjoyable for two-time world champion Alonso, though, as another mechanical issue with his McLaren cost him a first points finish of the season.

Then came the defining moment of the race. Impressive Toro Rosso teenager Verstappen crashed heavily after clipping Romain Grosjean's Lotus, but fortunately walked away.

It led to the safety car being deployed for the first time and the strange decision for Hamilton to pit - a horribly misjudged choice, which saw him re-emerge with Rosberg and Vettel ahead of him.

"I've lost this race, haven't I?" he asked over the radio and he was right, as Rosberg was followed home by Vettel after Hamilton failed to find a way past when the race resumed with seven laps remaining.

Red Bull's Daniil Kvyat and Daniel Ricciardo finished fourth and fifth, with Ferrari's Kimi Raikkonen sixth ahead of Force India's Sergio Perez.

McLaren were able to celebrate their first points of the season as Jenson Button crossed eighth, ahead of Sauber's Felipe Nasr and Carlos Sainz Jr of Toro Rosso.