A combative Elon Musk defended Tesla’s takeover of SolarCity and ripped into a lawyer for the shareholders suing over the deal on the first day of a trial that could saddle the electric carmaker’s chief executive with a huge compensation bill if he loses.

A group of Tesla shareholders, including some pension funds, has alleged that Musk engineered the $2.6bn acquisition in 2016 to bail out one of his grandiose ventures that had run out of funding options.

SolarCity, which installs rooftop solar panels, was founded in 2006 by Musk and two of his cousins. Despite the fact that Musk’s voting interest in Tesla was just 22 per cent, the suing shareholders alleged that the force of his persona allowed him to dominate the carmaker’s board and push directors into doing the deal.

Taking the stand on Monday in a dark suit, Musk said that SolarCity and Tesla were a natural combination that he had envisioned for years to achieve what he called a “sustainable energy economy”.

Since the deal was a stock-for-stock merger and he owned similar amounts of both companies, Musk said he “had no financial gain one way or the other”.

Musk also insisted that he had no role in negotiating the terms of the deal and that he did not think it was possible for him to control Tesla given the power of large institutional shareholders. “Fidelity, T Rowe [Price] and Capital Group couldn’t care less what I say,” he said.

A significant majority of Tesla shareholders approved the SolarCity takeover, and Musk has made little secret of his disdain for the dissident investors’ lawsuit.

Other directors settled the case for $60m, but Musk chose to fight. The trial was originally due to start in March last year but was delayed by the coronavirus pandemic.

On the stand in the Delaware courthouse, Musk personally attacked the attorney cross-examining him, the prominent plaintiffs’ lawyer Randall Baron of Robbins Geller Rudman & Dowd, saying: “I think you are a bad human being.”

Musk added that he had “great respect for the court, but not for you”.

When asked, the Tesla boss said his contempt for Baron stemmed from the legal problems that consumed the lawyer’s previous firm, Milberg Weiss, where several former partners pleaded guilty to paying kickbacks to get shareholders to join class-action suits against companies. Musk said Baron had been “mentored by criminals”.

If the court decides Musk controlled Tesla and the SolarCity deal was not in shareholders’ interests, he could be liable to pay compensation for the amount Tesla is deemed to have overpaid.

Baron sought in his questioning to force Musk to admit that he was the singular force at the company, with little to no oversight from the board. He showed clips from various interviews Musk had given, including to the 60 Minutes news programme and in news articles, and pointed out that Tesla board members were often connected to SolarCity or SpaceX, another Musk start-up.

Musk rarely gave brief responses, apparently irritating Baron, but offered glimpses into running Tesla. Musk said that 2017-19, when Tesla struggled to roll out its Model 3 electric car, “were three of the hardest years of my life”.

He also said he preferred being an engineer to a manager. “To be totally frank, I don’t want to be the boss of anything,” Musk said, but he had to be chief executive of Tesla “or the company was going to die”.