At a White House news conference on Wednesday, President Trump lavished praise on Steven Mnuchin for shepherding the $2 trillion stimulus package sailing through Congress, thanking his “great” treasury secretary for successfully handling negotiations on Capitol Hill.

But in the tense days of negotiations leading up to the final votes, Trump routinely fielded phone calls from conservative lawmakers and allies lamenting that Mnuchin was cutting a raw deal for the president.

Trump at times seemed to waver on his emissary, telling confidants he was worried that Mnuchin would “give away the store on the ‘green stuff,’” or agree to whatever House Speaker Nancy Pelosi (D-Calif.) demanded, according to two people familiar with the president’s private remarks.

Trump at one point asserted that he should be handling negotiations, as Mnuchin hurried between meetings with Senate Majority Leader Mitch McConnell (R-Ky.) and Senate Minority Leader Charles E. Schumer (D-N.Y.) that sometimes stretched beyond midnight.

Ultimately, Mnuchin survived the process and delivered a deal — punctuated by a 96-to-0 Senate vote late Wednesday night — that has invigorated Wall Street enough to drive the Dow Jones industrial average up by more than 3,000 points over three days.

Mnuchin was an ever understated, if occasionally awkward, central player at every step. At critical moments in the negotiations, Mnuchin persuaded McConnell to let him handle talks with Schumer, persuaded Schumer to close the deal and shelve certain requests and, most importantly, persuaded Trump to move as quickly as possible and ignore the gripes of some senators and White House advisers.

Now the treasury secretary must hope the bill he helped author can quickly stabilize a broader economy headed toward calamity, after putting his own credibility with the president on the line to pass it. The 57-year-old former banker, Hollywood financier and campaign money man is poised to emerge from this as one of the most powerful Cabinet members in modern history, with broad discretion over tremendous amounts of funding that is critical to millions of American households and businesses during one of the worst economic crises in generations.

“Treasury and Mnuchin will really be at the heart of everything now. So much of the driving force of the Senate bill goes directly under Mnuchin’s control,” said Steven Rosenthal, a fellow at the nonpartisan Urban-Brookings Tax Policy Center and former counsel at the Joint Committee on Taxation, who added that Mnuchin’s power over the crisis response dwarfs that of former treasury secretaries during the Great Recession.

Mnuchin will play a leading role deciding how to run a nearly $500 billion funding program, in which money can go to businesses, cities and states, as well as administering a separate fund for airline companies. As millions of people seek unemployment benefits, he will be responsible for quickly disbursing emergency checks of $1,200 to more than 100 million American households, a policy he persuaded the president to support over competing ideas by top aides. And Mnuchin will face competing demands from corporate executives, who will push to secure federal aid without giving up control of their companies, and the taxpayers whose money he will be wielding.

For each decision, Mnuchin will find himself on a tight leash, under constant scrutiny by Democrats, Republicans, a new inspector general, a new congressional oversight panel, as well as Trump, who has frequently criticized and sometimes mocked Mnuchin in front of other White House advisers over a range of decisions.

“There were people calling the president constantly, complaining about this provision or that provision,” said one person close to Mnuchin, who like others interviewed for this story spoke on the condition of anonymity to discuss internal deliberations about the negotiations. “[Mnuchin] convinced [the president] that if you have as big a package as possible, it’s going to change the psychology of the country and get the economy moving again.”

Mnuchin’s ascendancy is due in part to his capacity to forge bipartisan agreements, a rare skill in an administration heavily staffed by longtime conservatives with fierce ideological commitments often viewed warily by congressional Democrats.

But even as Mnuchin successfully steered the legislation through the Senate, the process was marked by second-guessing from some of the president’s allies.

Senate Banking Committee Chairman Mike Crapo (R-Idaho) and Sen. Patrick J. Toomey (R-Pa.), a leading fiscal conservative and former banker, were frustrated as Democrats made eleventh-hour demands and Mnuchin did little behind the scenes to defend the framework they arranged on a bipartisan basis over the weekend related to oversight of loan programs for major businesses, according to three Senate GOP aides close to them.

Sen. Lindsey O. Graham (R-S.C.) said he and Trump share the frustration that the deal included a much more generous expansion of unemployment insurance than conservatives initially envisioned, a policy Mnuchin had a central role in approving. He gave Mnuchin credit, though, for working hard to bridge divides and ultimately bring all sides together.

“He worked his ass off,” Graham said of Mnuchin.

On Wednesday, Trump expressed his full confidence in Mnuchin. “He’s a fantastic guy and he loves our country, and he’s been dealing with both sides — Republican and Democrat,” Trump said at a White House news conference.

Referencing the long hours Mnuchin spent at the Capitol, the president added: “He, sort of, lived over in that beautiful building. … And he’s gotten to know it, Steve, very well.”

The praise follows months during which Trump complained about Mnuchin’s recommendation to nominate Jerome H. Powell for chair of the Federal Reserve. Powell, who had already served on the Federal Reserve Board of Governors, easily won bipartisan support for the chairmanship, but Trump has complained about him ever since because he did not move quickly to cut interest rates. Trump has brought up Powell with Mnuchin dozens of times, a senior administration official said, sometimes mocking the treasury secretary in front of others for the recommendation.

But Mnuchin, who declined a request to be interviewed for this story, also has several strengths that have made him indispensable to Trump at this key moment, and he has helped bridge high-stakes divides multiple times in negotiations.

Initially, Republican lawmakers did not want to approve billions of dollars in federal assistance for states expected to be devastated by the economic impact of the coronavirus. The issue emerged as a major source of contention in private negotiations on Monday. Mnuchin relented, and started to say, “‘Okay, let’s get there,’” according to one person involved in the talks. The final package includes about $150 billion in emergency assistance for state and local governments.

For days, Mnuchin was also upbeat in his assessment of where talks stood, even on Monday, when Republican senators exploded at Democrats for delaying a vote. He refused to publicly bad-mouth Democrats during talks and kept insisting a final deal was within reach.

In days of negotiations in the Dirksen Senate Office Building, the treasury secretary ceded to a Democratic demand that expanded unemployment benefits reach workers for four full months. When the impasse emerged, Sen. Ron Wyden (D-Ore.), the ranking Democrat on the Senate Finance Committee, used the calculator feature on his iPhone to show Mnuchin what a fourth month of unemployment insurance benefits would cost. Mnuchin listened and then agreed, locking in a major expansion of jobless benefits that would incense several Senate Republicans but give Democrats a key reason to support the agreement.

“Mnuchin has played a critical role here going between the administration and Congress when almost nobody else in the president’s economic policy apparatus can,” said David Wessel, a senior fellow at the Brookings Institution, a nonpartisan think tank. “Early on in the administration, Mnuchin seemed to make himself more of a spokesman for the president than a serious policymaker. But confronted with a crisis like this, he seems to have been very involved in the important task of fashioning a compromise between Democrats and Republicans.”

Mnuchin may occasionally frustrate the president, but some former administration officials say he is adept at understanding what the president wants — accomplishments Trump can celebrate as his own — without worrying too much about narrow policy concessions that may be more important to more ideological aides.

“Trump sees the ability for Steven Mnuchin to deliver things for him that other people have not been able to deliver. He’s a very savvy Trump reader,” said a former administration official, who spoke on the condition of anonymity to discuss the relationship. “He’s always been very good at walking into a heated situation … and portraying the things he’s been able to achieve for the president as major achievements for the president, even when they were not.”

Mnuchin has had a sometimes rocky tenure at the helm of the Treasury Department. He worked for Goldman Sachs for close to two decades, rising through the ranks at one of the financial institutions frequently maligned by Trump’s 2016 presidential campaign. He was part of an investment group that ran OneWest Bank, a financial institution that aggressively foreclosed on homeowners and was accused of refusing to lend to minorities. (Mnuchin has repeatedly denied any wrongdoing.) He still keeps in close touch with numerous Wall Street contacts, including private equity billionaire Stephen A. Schwarzman.

Even as he has grown into his role as a Cabinet secretary, his public comments have caught some as tin-eared and out of touch with working-class and everyday Americans. He was criticized for posing for a photo with newly printed sheets of $1 bills at the Bureau of Engraving and Printing with his wife, the Scottish actress Louise Linton. He also has had to apologize to a government ethics office for promoting a film, “The Lego Batman Movie,” for which he was an executive producer.

And during the coronavirus negotiations, the Treasury Department’s demands have often appeared to reflect the wishes of big business rather than workers. Treasury pushed for widespread discretion to allocate hundreds of billions of dollars in emergency loans for large firms, proposing to give taxpayer funding to corporations with virtually no strings attached to guarantee employee protections.

“Look at their plan and you can see exactly who this guy is: Mnuchin is pushing a giant slush fund to give handouts to corporate America and was forced to add unemployment insurance for millions of Americans losing their jobs and money for hospitals in the middle of a pandemic,” said Alex Lawson, executive director of Social Security Works, a left-leaning advocacy group. “These were concessions he had to make. He sees a global pandemic as an opportunity to move taxpayer money into the wallets of his Wall Street friends.”

Mnuchin has repeatedly denied that the funding programs would amount to a “bailout,” though Trump has said they would amount to a bailout in some circumstances.

Mnuchin’s ability to deliver for Americans broadly will soon be tested. The day after the Senate’s passage of the legislation started off rocky, as Mnuchin told CNBC that the record number of unemployment claims were not “relevant,” given that they predate the bill. His choice of words earned an apparent rebuke on Twitter from Gary Cohn, the president’s former chief economic adviser, and were ridiculed as out of touch.

Taller tasks loom ahead. Mnuchin will soon have to prove he can meet his promise that $1,200 stimulus checks will reach most taxpayers in a matter of weeks, a claim that is already under scrutiny, as congressional aides and tax experts caution it could take significantly longer.

About $450 billion of the new emergency funding will be disbursed through the Federal Reserve’s lending facilities, a system that was activated during the last financial crisis, which could limit Mnuchin’s ability to directly steer the funding, said Ernie Tedeschi, a former Obama administration economist. The criteria for accessing that funding must be “broad-based” and cannot benefit any one company, Tedeschi said, but Mnuchin will play a central role in writing those rules and preventing the fund from being wasted.

And he will have to do this while seeking to maintain the support of the president, a contrast from prior treasury secretaries who in moments of crisis had the full backing of the chief executive, noted former congressman Barney Frank (D-Mass.), who was instrumental in the government’s response to the 2008 financial crisis. Mnuchin is responsible for delivering to Trump economic forecasts, which are expected to be brutal as the unemployment rate rapidly rises and jobless claims anticipated to grow. Months of devastating economic data could lead Trump to seek fresh voices.

“There is a lot of responsibility on Mnuchin’s shoulders,” said Rosenthal, the Tax Policy Center fellow. “It is remarkable for one man to be playing such a lead at this time of crisis.”

— Ashley Parker contributed to this report.