WASHINGTON — As Congress’ Democratic and Republican leaders for the last week tortuously negotiated a long-awaited $900-billion coronavirus relief package, President Trump remained mostly out of sight at the other end of Pennsylvania Avenue, tweeting falsely that he’d won reelection and hosting holiday parties despite a worsening pandemic.

The president’s lack of interest in the legislative process isn’t just that of a brooding lame duck struggling to come to terms with defeat. It’s been a constant of his four years in the White House. Elected in part because of his self-branding as a savvy mogul skilled in “the art of the deal,” as he titled one bestseller, Trump will leave office next month having cut few major deals, content with a political legacy defined far more by stoking cultural grievances and issuing often ineffectual executive orders.

He has taken credit for Congress’ biggest accomplishments, from a Republican tax-cut package to a criminal justice overhaul written largely by Democrats. He promised bipartisan deals on immigration, gun control, infrastructure projects and more, never following through. His role in the legislative process has been primarily as a disrupter whose erratic directives to lawmakers, most often delivered in tweets, frequently upend the already fraught policymaking process on Capitol Hill.

“Things are easier and more constructive when he is not engaged,” said Brendan Buck, who was a top aide to former House Speaker Paul D. Ryan (R-Wis.). “The problem is, to get anything passed, you need his endorsement at some point in the process. And that is where things often got hairy for us.”

At the outset of his presidency, Trump greenlighted Ryan’s effort to repeal President Obama’s Affordable Care Act as the Republican-controlled Congress’ first order of business — and then went about complicating the process. After organizing a Rose Garden celebration when the House passed its repeal bill, and hailing it as a “great plan,” it was reported that Trump privately told some senators that the House measure was “mean.” The bill ultimately failed in the Senate.

Having spent much of Trump’s first year on the futile fight over the healthcare law, congressional Republicans sought to recover by quickly passing a package of deep tax cuts favoring the wealthy and corporations; Trump, who was little involved, signed it into law in late December. Ahead of the 2018 midterm election, some Republicans were disappointed he didn’t do more to campaign on the tax cuts; he instead emphasized the alleged dangers of migrant caravans heading to the southern border.

“His heart just wasn’t in it,” said one senior Republican congressional aide, who asked not to be identified describing the president. “His heart is in what affects him personally.”

Departing presidents have often sought to use Congress’ postelection lame-duck session to pad their records of accomplishment. But Trump’s primary demand of lawmakers in the relief package being hammered out has been to include one-time direct payments to individuals, which most Republicans had opposed.

While Democrats have proposed such payments since May, the proposal wasn’t previously part of the 11th-hour negotiations. Its inclusion owed as much to pressure from some rank-and-file members, including a few Republicans, as to Trump’s Twitter feed in past weeks.

The president has largely left the negotiating details to Treasury Secretary Steven T. Mnuchin and Mark Meadows, the White House chief of staff, focusing instead on making unfounded claims of election fraud and — as he has for four years — playing to his political base.

At the same time, he has lately threatened on Twitter to veto the $740-billion National Defense Authorization Act, an annual measure that funds the military and that Republicans and Democrats have worked on for much of the year.

The bill passed in both the House and Senate with majorities larger than the two-thirds votes that would be needed to override his veto. Trump objected that it did not include an unrelated provision to remove legal protections for social media companies, including Twitter, which he claims are biased against him and conservatives.

Elaine Kamarck, a senior fellow at the Brookings Institution and veteran of the Clinton White House, said that Trump “has been the most uninvolved in legislation of any president in modern times.” And his deal-maker persona, the result of his decades-long branding effort, was always a ruse, in her view.

“He wasn’t a g— dealmaker in the private sector; he was just a bully,” Kamarck said.

Trump has spent far more time than his predecessor cultivating relationships with lawmakers, but only Republicans. And even as he has seemed utterly uninterested in the details of actual lawmaking, his susceptibility to persuasion by his most sycophantic allies has caused countless headaches for Republican congressional leaders.

“It was always a constant battle of trying to make sure you were the last one in his ear,” said Buck, the former Ryan aide.

During major legislative endeavors, “people in the White House would tell us, ‘You’ve got to keep talking to him, because other people are also going to be telling him the opposite.’ It was a constant struggle to keep him on the reservation.”

The culprit, as Republican leaders saw it, often was Fox News. In January 2018, for instance, Trump criticized a bipartisan bill to renew surveillance programs that was up for a vote in the House — after watching a Fox segment featuring a commentator erroneously suggesting that government officials had used the law to spy on Trump’s 2016 campaign. After congressional leaders objected that he’d risked killing the bill, Trump reversed himself in another tweet within the hour, encouraging lawmakers to support the renewal.

“Because he had such a shallow understanding of what was going on, it was very easy for people to knock him off course,” Buck said. “He wasn’t particularly invested in any of the policies we were pursuing, and certainly not the details.”

Following the 2018 midterm election, when Democrats won the House majority, Senate Majority Leader Mitch McConnell (R-Ky.) announced a year-end spending agreement to avert a government shutdown. It did not include additional funding for the president’s top-priority border wall.

Trump, incensed, tweeted that McConnell must “use the nuclear option and get it done!” That is, he demanded Republicans kill the Senate’s century-old filibuster rule to prevent Democrats from blocking the money, even though many Republicans opposed it as well.

Trump then threatened to shut down the government and actually followed through, causing a 35-day closure that cost the economy an estimated $11 billion. It ended with Trump’s retreat, and no additional wall money.

Stymied, the president declared a national emergency — a constitutionally dubious bid to circumvent Congress, which controls federal spending — to direct funds to his pet project.

“ ‘Build a wall’ is about as specific a policy advocacy that he had in the entire administration,” said Robert Rowland, an expert on presidential rhetoric at the University of Kansas. “A slogan is all he thinks he needs, and he’s rubbed up both against the realities of politics ... and the complexities of making public policy.”

In 2019, Trump and Democrats reached a tentative agreement to devise a $2-trillion infrastructure plan. But the president torpedoed it at a preliminary White House meeting on the matter, angrily informing Speaker Nancy Pelosi (D-San Francisco) that legislative cooperation wouldn’t be possible because House Democrats were separately investigating him.

Divided government yielded few opportunities for cooperation in the second half of Trump’s term, as the acrimony only deepened after Democrats opened an impeachment inquiry in the fall of 2019.

When the pandemic dashed Trump’s plans to base his reelection pitch on his economic record, he struggled to respond to the ever-deepening crisis. Leaving the negotiations largely to Mnuchin and congressional Democrats, in March he signed the $2.2-trillion package of aid for businesses and individuals known as the CARES Act, and directed the Treasury Department to print his name on the $1,200 checks the IRS sent to roughly 70 million Americans.

In recent months as the coronavirus continued to ravage the country, Trump exerted little pressure on Congress to pass a second relief measure beyond sporadic suggestions to distribute more payments to Americans with unused funds from the first relief package, and to do so before the election. Lawmakers declined.

“We always talk about the ‘October surprise.’ His October surprise was his inability to engage when he could have had a winning issue,” said Democratic pollster Peter Hart. “Here’s the wheeler-dealer, and instead of dealing, he folded and, consequently, he became a loser.”