* Vettel quickest for Ferrari in both sessions
* Hamilton 10th and fifth, Bottas second for Mercedes
* Raikkonen suffers engine failure in afternoon.
* Ecclestone attends race for first time in 2017 (Adds quotes, detail)
MANAMA, April 14 (Reuters) - Ferrari's Sebastian Vettel was fastest in Bahrain Grand Prix practice on Friday with the joint Formula One championship leader comfortably quicker than his Mercedes rival Lewis Hamilton despite problems in the second session.
The four times world champion lapped 0.400 faster than Red Bull's Australian Daniel Ricciardo in the afternoon and then pipped Mercedes' Valtteri Bottas by 0.041 under the evening floodlights.
Hamilton, the triple champion who won the previous race in China after Vettel's success in the Australian opener and shares the overall lead with 43 points, was 10th and fifth respectively.
Neither had a trouble free evening, however, with Vettel suffering what he called a "complete shutdown" on his car with half an hour to go.
The German was pushed into the pits by marshals and returned to the track 15 minutes later.
"It was not the best day for us, we still need to improve the car...On one lap it was OK. (on a) long run we might be quite a bit behind, but I am sure we can improve for tomorrow," said Vettel.
Hamilton ran off the track after being baulked by Nico Hulkenberg's Renault.
"These drivers are just so dangerous," the Briton said over the team radio, with both drivers later summoned to see the stewards.
Ricciardo was third in the evening with Ferrari's Kimi Raikkonen fourth after his afternoon session went up in smoke, with the Finn abandoning his smoking car and trudging off in the desert heat.
The solitary walk through the arid landscape in overalls and helmet, before being collected by a scooter, was an arresting sight -- and also typical of a driver with 'Iceman' tattooed on his left arm.
"Walking through the desert in 37C heat. In full race suit. Helmet on. Only the Iceman is cool enough to do it," the official formula1.com website observed on its Twitter feed.
While Raikkonen built up a sweat, Vettel settled in at the top of the timesheets with a best lap of one minute 32.697 seconds. He did 1:31.310 in the cooler evening conditions, with Raikkonen fourth after an engine change.
Champions Mercedes had been more focused on longer runs with heavier fuel loads in the searing afternoon heat, with Bottas only 14th.
They speeded up in the evening and did more laps than anyone.
"It's definitely tougher than before, driving in the heat with these new cars. But I'm used to being in a Finnish sauna, so it's no problem," commented Bottas.
The 'T-wing', fixed on the engine cover of the Finn's car, broke free during the second session and was collected by Verstappen's Red Bull, damaging the car's floor.
"It did about 50,000 pounds ($62,650) of damage so I think they should be banned on grounds of safety and cost," said Red Bull principal Christian Horner.
Mercedes non-executive chairman Niki Lauda spent much of the opening session chatting to the sport's former commercial supremo Bernie Ecclestone, who was appearing at a race for the first time since he was shuffled aside by chairman Chase Carey and Formula One's new owners Liberty Media.
Red Bull's Max Verstappen was third and eighth fastest.
German driver Pascal Wehrlein, who missed the first two races with a back injury, returned with Sauber and was 18th and 19th in the two sessions.
McLaren's Belgian rookie Stoffel Vandoorne, who scored a point in Bahrain last year as a stand-in, had a troubled day and stopped on track with engine problems 21 minutes from the end of the first session.
($1 = 0.7981 pounds) (Reporting by Alan Baldwin, editing by Ken Ferris and Toby Davis)