Nico Rosberg claimed pole position in a chaotic qualifying for the Hungarian Grand Prix that saw Q1 red flagged four times and Lewis Hamilton having to lift in Q3.
A heavy downpour in the build-up to qualifying resulted in an extremely wet Hungaroring circuit and a 20-minute delay to qualifying.
"It's pretty hairy out there," said team boss Claire Williams. "There's a lot of spray and standing water. The most important thing is the safety of our drivers."
Qualifying got underway in improved conditions with Sergio Perez leading a Force India 1-2 when more showers arrived.
The session was red flagged, resumed when the weather improved a tad, and was red flagged again when Marcus Ericsson crashed in the barrier at Turn 4, burying his Sauber under the advertising boards.
This time Daniel Ricciardo led a Red Bull 1-2 with Q1 back underway as Q3 should have been ending. However, a crash from Felipe Massa, who went wide out of Turn 4, saw the red flags emerge once again. And this time it was Felipe Nasr up in P1.
But with the conditions improving and everyone out on the intermediate tyres it was Nico Rosberg and Lewis Hamilton who topped the eventual Q1 times when the session was red flagged for a fourth time as Rio Haryanto went off.
Such was the drainage of the track that the drivers began to switch to slicks with five minutes remaining in Q2. Max Verstappen was quickest, Hamilton was tenth and Kimi Raikkonen was out in 14th place.
With the track dry barring a few puddles for Q3 it was, as to be expected, Mercedes who came to the fore.
Rosberg claimed pole position with a 1;19.965 as the German did not have to lift like Hamilton for Fernando Alonso's spin. Rosberg was 0.143s faster than his team-mate at the end of qualifying.
Ricciardo was third for Red Bull ahead of Max Verstappen and Sebastian Vettel.
Carlos Sainz qualified in sixth place while Alonso, who spun on his final hot lap, was P7.
1 Rosberg Mercedes 1:19.965
2 Hamilton Mercedes 1:20.108
3 Ricciardo Red Bull 1:20.280
4 Verstappen Red Bull 1:20.557
5 Vettel Ferrari 1:20.874
6 Sainz Toro Rosso 1:21.131
7 Alonso McLaren 1:21.211
8 Button McLaren 1:21.597
9 Hulkenberg Force India 1:21.823
10 Bottas Williams 1:22.182
11 Grosjean Haas 1:24.911
12 Kvyat Toro Rosso 1:25.301
13 Perez Force India 1:25.416
14 Raikkonen Ferrari 1:25.435
15 Gutierrez Haas 1:26.189
16 Nasr Sauber 1:27.063
17 Palmer Renault 1:43.965
18 Massa Williams 1:43.999
19 Magnussen Renault 1:44.543
20 Ericsson Sauber 1:46.984
21 Wehrlein Manor 1:47.343
22 Haryanto Manor 1:50.189