Oracle emerged late Sunday as the surprise victor in wooing short-term video app TikTok, which is proposing a compromise to the Trump administration that would allow it to potentially keep its current ownership, according to people familiar with the discussions.

The people, who spoke on the condition of anonymity to discuss the deliberations freely, said that TikTok recently put forward a proposal to the U.S. government that would allow its Chinese parent company, ByteDance, to retain ownership but outsource cloud management of the data. One of the people said that TikTok chose Oracle as its U.S. “technology partner” Sunday afternoon and that the companies brokered the deal in an attempt to satisfy regulator concerns.

Another possible element of the proposal, according to two of the people, is that ByteDance could move its headquarters outside of China to alleviate concerns that the parent company would be subject to Chinese laws that require firms, if directed, to share data in their systems with the government.

Treasury Secretary Steven Mnuchin and Commerce Secretary Wilbur Ross, who spoke late last week, are open to hearing the offer, said a senior administration official, speaking on the condition of anonymity because of the matter’s sensitivity.

“The deal, if it happens, is going to have to address our underlying national security concerns,” the official said.

But a former U.S. official said that while such an approach might address some of the security concerns, “it’s well short of a U.S. company taking over the asset and the algorithm, and politically, it would be a massive climb-down from what the president said he was going to accomplish with this.”

“It’s not a climb-down,” the administration official said. Any deal would have to be approved by an interagency group tasked with ensuring that national security concerns are mitigated, the official said. “All the details are not out,” the official said.

Oracle’s executives have close ties to the president, and the company may be well positioned to meet Trump’s expectations after the president took an active role in raising concerns about TikTok. The deal would probably involve Oracle, a business software giant best known for selling database technology to corporations to help run their operations, taking a stake in the company, one of the people said.

President Trump previously issued an order that would ban the app in the United States beginning Sept. 20. He followed that with a second order that would essentially require parent company ByteDance to divest from its operations in the United States.

TikTok has repeatedly insisted that it is not a national security threat and that it does not share any U.S. customer information with the Chinese government.

Both Microsoft and Oracle were bidding for the business, which has surged in popularity, particularly with young users. TikTok had 91.9 million monthly active users in the United States in June, up from 26.7 million in February 2019.

Microsoft said in a blog post Sunday that its offer to acquire TikTok‘s U.S. operations was rejected. Microsoft was the first to confirm that it was courting TikTok this summer as Trump threatened to ban the app over national security concerns.

“We are confident our proposal would have been good for TikTok’s users, while protecting national security interests,” Microsoft said in its post. “To do this, we would have made significant changes to ensure the service met the highest standards for security, privacy, online safety, and combating disinformation, and we made these principles clear in our August statement.”

Walmart had joined Microsoft’s bid for TikTok. Walmart said in a statement Sunday that it is still interested in investing in TikTok and will continue talks with ByteDance.

Oracle and TikTok declined to comment. The White House did not have an immediate comment.

The president said last month that Oracle was “a great company” that “could handle” buying TikTok.

While Oracle never seemed like a logical acquirer of TikTok’s U.S. assets, it had one thing going for it during its pursuit: a close relationship with Trump. Oracle’s chief executive, Safra Catz, has dined at the White House with Trump and served on the president’s transition team after his election in 2016. Oracle co-founder and chairman Larry Ellison hosted a fundraiser for Trump this year.

Earlier this year, Ellison helped convince Trump, after a series of conversations, that chloroquine and hydroxychloroquine, two old anti-malarial drugs, could be game-changing treatments for covid-19, the disease caused by the novel coronavirus. Ellison helped arrange a partnership between Oracle and the federal government to crowdsource that idea by collecting data in real time from doctors trying out those and other unproven drugs on covid-19 patients.

Trump has said that a “very substantial portion” of the acquisition price for TikTok would have to be paid to the Treasury because he helped manufacture the deal. While lawyers familiar with international transactions called such an arrangement unusual, it’s possible that Ellison and Catz, as supporters of the Trump campaign for reelection, could figure out a way to satisfy the president’s efforts to secure that payment.

The TikTok deal has been facing a series of obstacles for more than a month and was thrown another hurdle in recent weeks when the Chinese government got involved, slowing the bidding process. Beijing established export rules that prevent the sale of some artificial-intelligence technology that probably includes TikTok’s personalized recommendation algorithm.

The algorithm is TikTok’s secret sauce, technology that makes the service so popular and addictive to its users. Without it, the company’s value to an acquirer is significantly diminished.

Had Microsoft been able to acquire TikTok’s U.S. business, said Stifel, Nicolaus & Co. analyst Brad Reback, the company was well positioned to leverage its operations to make a deal pay off.

“It’s an extraordinary asset with all sorts of ways to make money,” Reback said.

Oracle, though, doesn’t have the operations, such as an online advertising business, to make an acquisition of TikTok’s U.S. operations pay off, he said.

“Oracle’s experience with consumer assets is zero,” Reback said.

While the phrase “technology partner” is vague, Reback said the agreement could call for Oracle to merely provide rudimentary cloud infrastructure services, essentially basic storage and computing functions.

TikTok previously filed a legal challenge against the government’s order to ban the video app. If the ban proceeds, TikTok users in the United States would probably still be able to use the app if they had already downloaded it, but wouldn’t be able to get any updates.

The parameters of the ban are still unclear, and it is up to the Commerce Department to define them.