(Bloomberg) -- Xiaomi Corp. and the U.S. government have reached an agreement to set aside a Trump administration blacklisting that could have restricted American investment in the Chinese smartphone maker.

The Chinese smartphone giant had sued the government earlier this year, after the U.S. Defense Department under former President Donald Trump issued an order designating the firm as a Communist Chinese Military Company, which would have led to a de-listing from U.S. exchanges and deletion from global benchmark indexes. The U.S. Defense Department has now agreed that a final order vacating the designation “would be appropriate,” according to a filing to the U.S. courts Tuesday.

Xiaomi didn’t immediately reply to a request for comment. Pentagon representatives weren’t immediately available for comment after normal hours. Shares of Xiaomi rallied as much as 6.7% in Hong Kong trading Wednesday.

“The Parties have agreed upon a path forward that would resolve this litigation without the need for contested briefing,” according to the filing. The parties involved are negotiating over specific terms and will file a separate joint proposal before May 20.

Xiaomi, which makes robot vacuum cleaners, electric bikes and wearable devices alongside smartphones, had been an unexpected target for the Trump administration. Co-founded by billionaire entrepreneur Lei Jun more than 10 years ago, with U.S. chipmaker Qualcomm Inc. as one of the earliest investors, the company has insisted it’s not owned or controlled by the Chinese military.

The agreement comes after a U.S. court in March sided with Xiaomi in the lawsuit and placed a temporary halt on the ban. U.S. District Judge Rudolph Contreras said at the time Xiaomi was likely to win a full reversal of the ban as the litigation unfolds and issued an initial injunction to prevent the company from suffering “irreparable harm.”

Read more: Xiaomi Jumps After U.S. Trading Ban on Phone Maker Is Halted

The agreement marks a rare victory for China’s technology giants caught in the crosshairs of the U.S. government, as the two nations clashed over issues ranging from trade to human rights and Hong Kong’s rule. Trump had signed an order in November barring American investment in Chinese firms owned or controlled by the military in a bid to pressure Beijing over what the U.S. has described as abusive business practices. The order against Xiaomi, alongside a handful of other Chinese firms, was issued in the waning days of his administration.

Trump had also gone after other Chinese behemoths including ByteDance Ltd., owner of the hit video app TikTok, and Tencent Holdings Ltd., which owns the WeChat super app. Huawei Technologies Co. was the hardest hit, after it was barred from buying American-made components and shut out of infrastructure projects around the world.

Read more: How Huawei Became a Target for Governments: QuickTake

(Updates with shares in third paragraph.)

©2021 Bloomberg L.P.