Leclerc suffered a bad opening lap in which he slipped from first to third and only just fended off Lewis Hamilton’s Mercedes, before recovering brilliantly to take control of the race.
The 21-year-old held a comfortable lead when he reported an engine problem with 10 laps to go and Ferrari told him he had no energy recovery from the MGU-H.
That meant Leclerc was passed by Hamilton and Valtteri Bottas and was set to be overtaken by the Red Bull of Max Verstappen as well, before being saved by a safety car two laps from the end.
Assessing the loss of his first F1 win on his second start for Ferrari, Leclerc said: “It happens. It is part of motorsport.
“Unfortunately today was not our day but I am confident the team has done an amazing job to recover the lack of pace of Australia.
“Of course I am extremely disappointed, like the whole team, but it happens during the season.
“We have been lucky in a very unlucky situation. I’m happy to have the safety car at the end otherwise we would have finished even more rearward, and with fuel I don't think we could have been OK.”
To take the lead of the race Leclerc had to re-pass Bottas and Ferrari teammate Sebastian Vettel, and the Monegasque admitted his “very strong” grand prix only made the outcome harder to take.
In the immediate aftermath of the result he also found it difficult to take his first F1 podium as much consolation.
“As I have said a lot in the past, I am never looking at the result, I am looking at the potential to do better,” he said.
“Today, third was not our place.”
Leclerc’s mechanical problem and Vettel spinning while battling Hamilton let Mercedes steal an unlikely one-two in Bahrain.
Hamilton paid tribute to Leclerc over the team radio after winning and said afterwards that Leclerc “has a lot of wins coming in the future”.
“This weekend Ferrari have been incredible,” said Hamilton. “I’m sure it was a devastating result for him.
“We were definitely lucky today.”
His teammate Bottas added: “As a team we got a bit lucky today.
[But] we kept it together, did no mistakes as a team and the car was very reliable, and that is the win today.
“Otherwise it was a difficult race for me. The balance was a bit everywhere."
Sebastian Vettel, Ferrari SF90 leads Charles Leclerc, Ferrari SF90 at the start of the race followed by Valtteri Bottas, Mercedes AMG W10 and Lewis Hamilton, Mercedes AMG F1 W10
Andy Hone / LAT Images