A New Jersey agency has agreed to ban Tesla from selling cars directly to consumers in the Garden State Tuesday.

Tesla (TSLA) has been selling directly to shoppers at two locations in New Jersey for about a year, but state officials will now force the automaker to sell cars through a franchised car dealership.

James Chen, a Tesla attorney, told members of the New Jersey Motor Vehicle Commission that the change will force Tesla to close its existing sales operations in the state and layoff 27 employees, according to documents posted to the commission's website.

Tesla's practice of selling its Model S electric sedan directly to consumers is unusual and has run into problems before. Chief Executive Officer Elon Musk has tangled with dealership associations in various states including Texas and New York.

Related: Tesla lashes out at Chris Christie

The change agreed to by the New Jersey commission Tuesday, "simply conforms their regulation with state law," said Jim Appleton, the president of the New Jersey Coalition of Automotive Retailers, also known as NJ Car.

Appleton favors the law, which aims to encourage price competition and ensure customers have access to warranty and recall services, he said.

Tesla was not immediately available for comment. A spokesman said the company would issue a statement soon.

Earlier in the day Tesla railed against the pending move. "This is an affront to the very concept of a free market," Tesla said in a blog post.

To continue selling cars in New Jersey, Tesla will have to sell them through franchised dealers just like General Motors (GM), Ford (F), Toyota (TM) and other automakers -- unless the company successfully challenges the state law in court or lobbies legislators to change the law.

Christie administration spokesman Kevin Roberts said it has been made clear that state law would need to be changed by the legislature in order for Tesla to directly sell to customers.

"This administration does not find it appropriate to unilaterally change the way cars are sold in New Jersey without legislation and Tesla has been aware of this position since the beginning," Roberts said.