Formula E championship leader Felix Rosenqvist has revealed Mahindra only just finished a last-minute rebuild of his second car in time to complete his Marrakesh victory.

The team was alerted to a battery problem before the start of the race, which barely gave it time to complete a change that usually takes at least an hour.

Rosenqvist started in the other car and the pitstops occurred 25 minutes into the race – one hour after the Swede said his car “was in half”.

Rosenqvist Wins

Rosenqvist Wins

“I was praying my second car would be ready," he said.

“My guys told me like one lap before they stopped working on the car so a really big thanks to the Mahindra boys for putting that together so quickly.

“And the car felt great!”

Rosenqvist also had to overcome a difficult practice in which he “was struggling a lot” and “would have settled for being in the midfield” before his team made a breakthrough in getting the tyres to work.

This allowed him to qualify third, pass Sam Bird when the DS Virgin Racing driver had a brief loss of power due to a gearbox problem and then focus on catching poleman Sebastien Buemi.

In a mirror of last season’s race, when Buemi caught and passed polesitter Rosenqvist, the Swede overhauled the Renault e.dams driver to take his third victory and the points lead.

“It was funny how it was turned around from last year between me and him,” Rosenqvist told Motorsport.com.

“it’s cool how you can come back and you feel so much more calm in the car.

“You just have so much more brain capacity to look at your instruments, your dash and see where you are, like put a bit of perspective on the whole race and then just pull off the perfect move.

“It was really cool to come back and do that.”

Rosenqvist’s pass for the win involved squeezing alongside Buemi on the back straight and, while on the dusty inside line, beating him on the brakes for the Turn 7 left-hander.

“It was very slippery on the track, so that was probably why it was wobbling a bit,” Rosenqvist said.

“Once I was past him I realised that I’d got it because he was worse on energy and I think that he’s clever enough to not risk it all for that.

“It wasn’t the hairiest , let’s say.”