TAIPEI - Taiwan's Foxconn, the world's largest contract electronics maker, said on Friday its subsidiary in China has agreed to sell its entire equity stake in embattled Chinese chip conglomerate Tsinghua Unigroup.

Taiwan has turned a wary eye on China's ambition to boost its semiconductor industry and is tightening legislation to prevent what it says is China stealing its chip technology.

Foxconn, a major Apple Inc supplier and iPhone maker, disclosed in July it was a shareholder of Tsinghua Unigroup.

Foxconn did not seek approval from the Taiwan government before the investment was made and authorities believe it violated a law governing the island's relations with China, people familiar with the matter have previously told Reuters.

Foxconn said in a late night statement to the Taipei stock exchange that Xingwei, 99% controlled by its China-listed unit Foxconn Industrial Internet Co Ltd, has agreed to sell its holdings for at least 5.38 billion yuan ($772 million).

Xingwei controls a 48.9% stake in a different entity that holds a 20% stake in the vehicle owning all of Unigroup.

Foxconn provided no explanation for the decision in its filing. Neither Foxconn nor Tsinghua Unigroup immediately responded to a request for comment on Saturday.

Foxconn said in August it had a plan B if Taiwan's government did not approve the investment, giving no details at the time.

Taiwanese law states the government can prohibit investment in China "based on the consideration of national security and industry development". Violators of the law could be fined repeatedly until corrections are made.

Foxconn, formally called Hon Hai Precision Industry Co Ltd, is keen to make auto chips in particular as it expands into the electric vehicle market.

The company has been seeking to acquire chip plants globally as a worldwide chip shortage rattles producers of goods from cars to electronics.

Taipei prohibits companies from building their most advanced foundries in China to ensure they do not site their best technology offshore.

Taiwan's government has been extra wary of China since Beijing began staging regular military exercises near the island three years ago to assert its sovereignty claims, including war games with missiles in August.

Originating as a branch of China's prestigious Tsinghua University, Tsinghua Unigroup emerged in the previous decade as a would-be domestic champion for China's laggard chip industry.

But the company fell into debt under former chairman Zhao Weiguo, prompting it to default on a number of bond payments in late 2020 and eventually face bankruptcy.

The conglomerate has yet to produce any global leaders in the semiconductor sector.

(Reporting by Meg Shen and Ben Blanchard; Editing by Louise Heavens and Tom Hogue)