Tesla's chief technology officer – and co-founder – JB Straubel is leaving the company after 16 years, the latest in a series of key departures from the electric car maker.

Mr Straubel will take on an advisory role and will continue to be involved with Tesla, its chief executive Elon Musk said on Wednesday night.

He has been at Tesla since 2003, when Mr Musk also joined during the company's early fundraising. Along with Mr Musk he has since been referred to as one of Tesla's five founders despite joining shortly after the company's formation.

Tesla has endured a series of executive departures in the last year amid a tumultuous period for the company, although Mr Straubel said he was not leaving because of any issues with the company.

"I'm not disappearing, and I just wanted to make sure that people understand that this was not some lack of confidence in the company, or the team, or anything like that," he told investors. Tesla said Drew Baglino, its vice president of technology, will take his place.

It came as Tesla reported a worse-than-expected loss despite selling a record number of its electric cars in the second quarter of the year.

The company lost $408m (£327m) in the three months to the end of June, it said on Wednesday night. Shares fell by more than 10pc in after hours trading following the results.