When Lewis Hamilton and Valtteri Bottas both met with the media following Saturday’s Formula 1 qualifying session for the Bahrain Grand Prix, neither was in the most upbeat of moods.

Ferrari had just locked out the front row of the grid, with Bottas failing to disrupt the Prancing Horse’s party, taking third place. Lewis Hamilton was left licking the wounds of a five-place grid penalty for a gearbox change, and was pretty anonymous regardless, qualifying fourth. The 0.6 second advantage that had rocked the paddock in Melbourne had disappeared.

It seemed there would need to be a dramatic turnaround for Mercedes to come away with victory in Bahrain. But much as a perfect storm allowed Ferrari to snatch the win in Australia, the stars almost aligned for Mercedes to emerge victorious in Bahrain.

The start was crucial for Mercedes. Bottas had to get in the thick of the Ferrari presence at the front if he were to stand any chance of victory. Had Sebastian Vettel and Kimi Raikkonen stayed one and two through Turn 1, they’d have been able to control proceedings well at a track where tyre management and, in particular, fuel consumptio, were key.

Bottas played his role perfectly. A good getaway allowed him to sweep around the outside of Raikkonen at the first corner, rising into second, and he was able to apply some pressure to Vettel at the front. The Ferrari driver could not simply skip away into the lead as he may have been able to had his teammate been there to play rear-gunner.

Strategy was a big talking point heading into the race, with the crossover between a one-stop (start on Supersoft, switch to Softs) and two-stop (Supersoft, Soft, Soft) being faster being small according to predictions. The fact that all of the top eight drivers in the race ran different strategies proved just how variable things were.

Mercedes knew it lacked the outright pace to beat Ferrari, so had to think on its feet. The decision to one-stop Hamilton seemed sensible given his low starting position, but Bottas? It was bold. It would put him at risk later on.

The German marque played the race perfectly, though. It did not react immediately to Ferrari’s stops for both Vettel and Raikkonen, instead keeping Bottas and Hamilton out a little longer. Bottas eventually dived into the pits at the end of Lap 20, fitting a set of white-banded Mediums. They would be taking him to the end of the race.

Surely it would be fine for Vettel, though? He had a seven-second buffer over Bottas, with 24 seconds being the magic total for a pit stop. Even if he couldn’t pull that out through the second stint of the race on the faster Soft tyres he fitted, he would surely be able to recover it on fresh rubber through the closing stages as Bottas struggled.

But Mercedes then began to run against the rulebook. Both Bottas and Hamilton, who pitted from the lead six laps later, not only matched the Ferrari drivers despite them being on a compound estimated to be some four-tenths of a second per lap quicker - they actually went faster.

Ferrari was at serious risk of losing a race it seem unlikely to lose. Both Vettel and Raikkonen seemed committed to coming in for a second time, yet if the Mercedes kept up their current pace, they would stand little chance of recovering the position.

Running third, Raikkonen was used to test the water; that was the intention at least. Ferrari brought the Finn in at the end of Lap 35 and moved him on to Supersofts, seemingly to gauge the pace advantage they would offer. While the Softs couldn’t give Ferrari the chance to go faster, the Supersofts might. Alas, the light went green too soon, Raikkonen hit the throttle and pulled away, taking one of the crew members with him. Francesco Cigarini was taken to hospital where he was found to have suffered a broken leg.

Vettel was now left all alone to fight at the front of the pack. It was a role reversal from Australia, where Ferrari had forced Mercedes into a corner when going two-on-one. Hamilton was around 20 seconds down the road, meaning that while only Bottas could win the race, Vettel might have ended up a lowly P3.

The picture soon became clear for Ferrari: if Vettel was going to win the race, he was going to have to stay out. His Soft tyres would need to last a mammoth 39 laps if they got to the finish, all while keeping a decent pace.

Vettel began to up his pace, pulling the gap to Bottas out to around seven seconds with 13 laps to go. Having clocked that Ferrari was staying out, Mercedes gave the Finn the call to up his pace, with the gap slowly whittling down before the grandstand finish.

“I was thinking somewhere mid-race with the lap times we were doing that if I had one lap like qualifying the gap would be massive to Valtteri, I could breathe again,” Vettel said after the race.

“When we’re racing we’re on the same set of tyres and they’re not getting better, you’re running down the fuel so you should get faster but obviously sliding more and more. You’re not able to push as hard as in qualifying, that’s where the gap is coming from.

“For us the plan was different initially, and our only chance really as the tyres were holding on quite well was to stay out - and it just worked.”

Just worked. Six-tenths of a second was the gap at the flag. Bottas’ one and only real attempt at a pass came at Turn 1 on the final lap, only for Vettel to close him off. The Ferrari driver’s tyres just about held on, completing the 39-lap odyssey that seemed so unlikely before.

“I think we had nothing to lose,” Vettel said. “If we pit again with five laps to go we finish third. Equally I felt if we pitted 15 or 20 laps to go it would be difficult to make progress, because I guess the medium tyres were more consistent that it would’ve been much harder to get past Lewis initially he was ahead.

“We responded well after it looked like they put us in checkmate. Obviously still happy to come out on top.”

It was check, but not checkmate. Ferrari had only one possible move, yet it managed to make it work, much to Mercedes team boss Toto Wolff’s surprise.

“We had won the race already after coming out on the Medium behind Sebastian with a gap,” Wolff said. “We were able to close down knowing they would need to stop once again, or they would run out of tyre if we were to push them.

“This was the moment where I would say probably the 90 percent probability was on us winning, and we lost at.”

Woulds and coulds and ifs and buts are banded about the F1 paddock regularly - but Mercedes has been left for the second time in two races looking at the fine margins where the race was lost. A little more pace from Bottas through the middle of his Medium stint might have been decisive. Alas, it wasn’t to be.

The bittersweet taste for Mercedes will be a strange one. It can take heart from its display, having run Ferrari so close in a race it seemed highly unlikely to win after qualifying. As through testing, its Medium-tyre pace was impressive, boding well for China next weekend where the compound will be available once again. Wolff even admitted that if you’d offered him P2 and P3 after qualifying, he’d have taken it, given Hamilton’s starting position and the threat of the Red Bulls.

But just as in Australia, there needs to be recognition of the job that the race winner, Vettel, did. He didn’t luck into this win quite as much as he did in Melbourne. He led 49 of the 57 laps, and produced a tyre stint that seemed impossible.

Vettel escaped a checkmate move from Mercedes in Bahrain. With two wins from two races and a 17-point buffer over Hamilton in the drivers’ championship, it has been a start to the season that Ferrari could only have dreamed of making when it saw the Mercedes scamper into the distance in the first stint in Australia.