South African-born billionaire businessman Elon Musk worked illegally in the United States during a brief period in the 1990s while building a startup company, the Washington Post reported on Saturday.

Musk denied the report on Sunday, saying he was allowed to legally work in the U.S. during that period. “I was on a J-1 visa that transitioned to an H1-B,” he said on his social media platform X. The J-1 Exchange Visitor visa lets foreign students get academic training in U.S., while the H1-B visa is for temporary employment.

The news outlet reported that Musk arrived in Palo Alto, California, in 1995 to attend Stanford University but never enrolled in his graduate studies program there. Instead, he developed software company Zip2, which sold in 1999 for around $300 million, according to the outlet.

Two immigration law experts quoted by the Post said Musk would have needed to be enrolled in a full course of study in order to maintain a valid work authorization as a student.

Musk in a 2020 podcast cited by the Post said: “I was legally there, but I was meant to be doing student work. I was allowed to do work sort of supporting whatever.”

The Washington Post cited two former Musk colleagues who recalled Musk receiving his U.S. work authorization in or around 1997.

Musk has endorsed Republican presidential candidate Donald Trump in the Nov. 5 U.S. election in which the former president faces Democratic Vice President Kamala Harris in what polls show to be a tight race.

Trump has for years portrayed migrants as invaders and criminals, and during his 2017-2021 presidency took stringent steps to curb legal and illegal migration. He is promising the biggest deportation effort in U.S. history if he is reelected.