TeslaUtah
A Tesla dealership lot is seen empty in Salt Lake City, May 29, 2015. Tesla was allowed to build a dealership in Salt Lake but when it was finished, Tesla was denied a dealer license because Utah law doesn't allow direct sales from auto make only from third party dealer. REUTERS/George Frey

The Utah Supreme Court dealt a blow to Tesla, Inc. with a ruling Monday that denies the electric car maker permission to sell its vehicles directly to potential customers in the state. The setback for the Elon Musk company came the same day its stock price reached an all-time high on the back of a record performance in the first quarter of the year.

The court ruled 5-0 against Tesla, upholding a state law that prohibits vehicle manufacturers from owning dealerships, forcing them instead to sell through third-party dealerships. Tesla, which has been trying to get a license to sell its own cars in Utah since 2015, constructed a $3 million building in Salt Lake City under a subsidiary it created for the purpose, called Tesla UT.

Read: Tesla Had A Record Quarter For Production, Deliveries

It was meant to be a full-fledged store but has been operating as service center and gallery after Tesla UT’s application to sell vehicles was turned down. As the law currently stands, people who walk into the building can have their Tesla vehicles serviced there, or look at the cars on display, but Tesla employees cannot sell any vehicles, discuss their price or offer test drives.

Utah laws mandate automakers to sell vehicles through franchises in which they have no financial interest. Tesla has been lobbying to have the laws changed, so it can sell its cars either directly or through a franchise that it owns. And the company has argued that Utah customers would benefit if they had direct access to its “innovative vehicles,” the Salt Lake Tribune reported.

In its ruling, the court said: “The reach and breadth of our laws are measured by the words that were voted on by the Legislature and signed into law by the governor — not the general function or purpose we may ascribe to the law in retrospect.”

Responding to the unfavorable decision, Tesla told International Business Times in a statement: “The Utah ruling is disappointing for Tesla and all Utah consumers interested in consumer choice, free markets, and sustainable energy. We will pursue all options to ensure that Tesla can operate in Utah without restriction. In the meantime, we will continue to provide service and limited sales activities (through our used car license) at our location in South Salt Lake City.”

But Monday wasn’t all bad news for Musk and his company. On the back of its best performing quarter to date, in terms of vehicle production and deliveries, the Tesla stock rose 7.27 percent during trade on Nasdaq. Closing at its all-time high of $298.52, the shares gained over $20 in one day and the company’s market cap is now $48.69 billion, which is over $3 billion more than Ford Motor Company and just over $2 billion shy of General Motors.

Musk defended the stock valuation on Twitter after some analysts pointed out the stronger financials of Ford.

The Tesla statement in the story has been updated.