A judge ruled in a National Labor Relations Board (NLRB) complaint Friday that Tesla CEO Elon Musk broke labor laws in May 2018 when he tweeted that the electric vehicle company's employees won't be able to have stock options if they choose to unionize.

Judge Amita Baman Tracy noted that Musk and Tesla leadership have also fired employees who have engaged in union-organizing activity and prevented union information from being displayed on Tesla company premises.

Judge Tracy said that Musk would have to convene his employees at Tesla Factory in Fremont, California, and also read a statement from the court as to why Tesla broke the law. Tesla is expected to appeal the ruling.

In May 2018, Musk posted a series of tweets in conversation with another user where he criticized unions and resulted in United Automobile Workers (UAW) filing a complaint with the NLRB.

Musk claimed that Tesla Factory has a better safety record than when the UAW was present there and implied that Tesla workers would give up stock options in exchange for union benefits.

Musk also said in the tweets that UAW wants "divisiveness & enforcement of 2 class 'lords and commoners' system, That sucks."

The NLRB noted that in a June 2017 meeting with Tesla employees, Musk solicited employees' complaints on safety issues at the Fremont plant, and said he would work to address their concerns "if they refrained from their union organizational activity."

In February 2017, Musk had sent an email to employees at the Fremont facility refuting allegations of poor working conditions and low pay. Musk said in the email that the UAW's true allegiance is to "giant car companies, where the money they take from employees in dues is vastly more than they could ever make from Tesla."

Musk's tweets have landed him in trouble before. Musk tweeted in August 2018 that he planned to take Tesla private, which drew scrutiny from the Securities and Exchange Commission (SEC). Musk was eventually fined $20 million and was ousted as the company's chairman due to the tweet.