Tesla is having a rough week, and it just got a little worse.

On Wednesday, a judge handed a small victory to Tesla shareholders, allowing them to move forward with a lawsuit against CEO Elon Musk and Tesla's board. The complaint alleges Musk overstepped his bounds when Tesla (TSLA), his electric car company, acquired the solar energy services firm SolarCity.

Under US law, heads of publicly traded corporations are required to act in shareholders' best interests — and the suit claims that Tesla's $2.6 billion takeover of cash-strapped SolarCity violated that law.

The complaint accuses Musk of using "his control over the corporate machinery to, among other things, orchestrate Board approval of the Acquisition." It also claims the merger amounted to "a bailout" of SolarCity — which was deeply in debt — and primarily benefited a handful of Tesla board members.

Related: Tesla has a problem. Maybe a big problem

Musk's legal team argued the original complaint failed to prove Musk was the controlling stockholder of Tesla at the time of the merger.

But the Wednesday ruling by a Delaware judge sided with shareholders. The decision allows the investors to move ahead with the lawsuit.

Tesla said in a statement that it does "not agree with the decision and will be taking appropriate next steps."

"It's important to emphasize that this was a motion to dismiss in which the court was required to assume as true all of the allegations that are made in the complaint," the company said. "We of course contend the allegations in the complaint are false."

The development adds to a chorus of disappointing developments for the electric carmaker. Investors are increasingly worried about Tesla's ability to deliver on its promises and could be headed for a cash crunch. Its stock has plunged nearly 19% over the past five days.

Tesla has suffered numerous production issues with the Model 3, the company's first mass-market car. It's considered key to evolving beyond a nice luxury automaker and turning Tesla into a mainstream brand.

Musk, however, is no stranger to executing surprise turnarounds. Tesla used to be the company everyone in Silicon Valley loved to hate, and the firm very nearly went bankrupt back in 2008.