House Speaker Paul D. Ryan (R-Wis.) speaks as the late former president George H.W. Bush lies in state Dec. 3 inside the Capitol Rotunda in Washington. (Brendan Smialowski/Pool/Reuters)

House Speaker Paul D. Ryan is using his final weeks in Congress to leave a lasting image of a brainy conservative warrior for lower taxes, free markets and a more muscular America abroad — in public appearances, a taxpayer-funded online video series and a farewell address set for Wednesday.

But after two decades in the House and three years as speaker, the Wisconsin Republican’s long-term legacy is already a matter of fierce debate inside his own party.

While Ryan shepherded a broad GOP tax bill last year and negotiated major increases in military spending, his repeated promises to sweepingly address the solvency and growing costs of two mandatory government programs — Social Security and Medicare — never happened, even though Republicans controlled all levers of government for the past two years.

Ryan often spoke of the imperative of fiscal discipline, especially during the eight years of the Obama administration. But the nation’s red ink has grown since Ryan became speaker, soaring from $438 billion in 2015 to $779 billion this year. And many economists blame the tax cut as a culprit as next year’s deficit is projected to hit nearly $1 trillion.

Politically, the picture is just as bleak, according to a bloc of Ryan’s former fellow-travelers in the conservative intellectual sphere. His brand of aspirational conservatism has shown little currency in the face of President Trump’s brash populism, and November’s midterms put an exclamation point on Ryan’s efforts to insulate the GOP from Trump: Republicans lost 40 seats, their worst showing in 44 years, and relinquished the House majority.

The ensuing lame-duck session has offered only small succor: likely passage of a criminal justice overhaul that Ryan has championed, alongside another spending showdown — and potential government shutdown — emblematic of Congress’s rolling dysfunction. Big issues dear to Ryan such as immigration and poverty will remain for future lawmakers to solve.

“He was the future of the party, but it’s been a disappointing couple of years,” said William Kristol, a conservative commentator and Trump critic who has known Ryan for decades. “He was in a tough situation and didn’t make the best of it.”

Ryan and his allies are arguing the opposite in these final weeks, making the case that the pointed critiques ignore the political reality of the Trump era, in which traditional conservatives like Ryan have been forced to seek wins where they can and otherwise play defense against Trump’s bad impulses.

His farewell address, to be delivered in the Great Hall of the Library of Congress, will seek to highlight those victories and acknowledge how and why he fell short elsewhere, said an aide familiar with his planned remarks.

“Doing all of this helps build his stature and reminds people he’s a young guy with a great future,” said former GOP speaker Newt Gingrich. “This is a deeply divided party, and Paul Ryan has every right to communicate values and beliefs that led him to where he is.”

At a November event hosted by The Washington Post, Ryan said he was able to “build up the country’s resilience, its antibodies, its health, its strength” by passing the tax and military spending legislation while also expressing regret at not making more progress in rolling back entitlement spending or remaking the immigration system — two areas in which he and Trump were sharply at odds.

“I saw a chance of getting a lot of good policy done for the country that was a long time in coming, and we got a great deal of it done,” he said, adding, “I’m not one of these big-ego legacy guys. I like to think that I took the opportunity I was given and made a positive difference in people’s lives.”

Spencer Zwick, a senior political adviser and fundraiser for the outgoing speaker, said Ryan has been frustrated that his work “isn’t really fully reported.” Aides, for instance, are quick to point out that the House passed a health-care overhaul that, by restructuring Medicaid, represented the most significant entitlement rollback in decades, as well as bills that placed work requirements on food stamps and other welfare programs.

Those bills went nowhere in the Senate and fueled campaign attacks that Democratic leaders credited with helping to flip the House majority.

“People can criticize Paul if they want; people can always find a reason,” Zwick said. “The fact is, Paul leaves an enormous legacy as speaker for the country and the GOP. Not everyone has to love the guy, but if you peel back all the things he was able to get accomplished, there is a lot there.”

Yet the journey from beacon of the GOP’s future to emblem of its tumultuous present has Republicans — who, nearly to a person, say they like Ryan personally — grappling with whether he is responsible, alongside Trump, for the party’s drift.

Several longtime friends of Ryan declined to make public comments, citing their private disappointment in him and saying Ryan would be personally hurt if they shared their blunt assessments. “Paul doesn’t want to believe it’s all as bad as it is,” one said.

Ryan’s House colleagues tend to be more charitable in their assessments — seeing in him their own struggles with Trump’s takeover of Republican politics. And scores of rank-and-file GOP lawmakers have quietly appreciated Ryan’s willingness to step up and serve in a thankless job after predecessor John A. Boehner (R-Ohio) retired under pressure in 2015 — and stay in it after Trump’s victory.

Asked about Ryan’s farewell, Rep. Tom MacArthur (R-N.J.) said the tax cuts and regulatory measures the House passed are “worth celebrating” and waved away the lack of progress on spending cuts. “It is what it is,” said MacArthur, who lost his reelection bid last month. “No speaker or president operates in a vacuum. There are a lot of things he wishes he could have done.”

Several current and former colleagues, including Boehner, testified to Ryan’s diligence in the six-part online video series that Ryan’s office published Tuesday. With dramatic music and images, the videos depict the making of the tax bill, starting from Ryan’s 1998 election to Congress at age 28 to the bill’s final passage late last year.

The videos highlight the tax bill’s short-term effects — including raises for some employees and a dipping unemployment — but gloss over the drastic fiscal effects of the bill. After pledging to pursue tax reform that was “revenue neutral” — that is, one that would not result in a net decrease in federal receipts — Republicans instead pursued one projected by the Congressional Budget Office to cost $1.5 trillion over its first 10 years.

Another area in which Ryan made only fitful progress was his much-trumpeted anti-poverty agenda, where he sought to follow in the footsteps of his mentor Jack Kemp — a conservative ideas man of a previous generation — to apply free-market principles to create opportunities in impoverished communities. The tax bill included a provision creating low-tax “opportunity zones,” but more ambitious ideas never made it into law.

“There wasn’t a lot at all on policy, but Paul did the best he could under the circumstances he faced,” said veteran anti-poverty organizer Robert Woodson, who has worked closely with Ryan and traveled with him to many urban churches. “You can’t blame him for Washington. He did what he could to elevate the profile of this issue. I just don’t think this is a priority for Washington like it should be.”

Ryan also had to battle critics to his right, including former White House chief strategist Stephen K. Bannon, who derided him as an establishment favorite who was “born in a petri dish at the Heritage Foundation,” the conservative think tank.

Rep. Steve King (R-Iowa), a conservative hard-liner and frequent critic of leadership, said he respects Ryan but said many of Trump’s core voters have associated him with a lack of progress on the president’s agenda — including the promised border wall at the center of the current standoff.

“Two years have gone by and not much has been done, and we’re sitting here looking at the necessity perhaps of a shutdown to get just $5 billion for something that the leadership should have done last year,” he said.

With Rep. Kevin McCarthy (R-Calif.) — a gregarious politician and Trump ally — set to succeed him as top House GOP leader, Ryan’s departure has renewed questions about who will emerge as the party’s standard-bearer for traditional conservatism.

“While there is still not much of a distinctively Trumpist agenda, the pre-Trump conservative agenda has run out of steam, too,” National Review writer Ramesh Ponnuru wrote this year. “Republicans retain enormous power in Washington but have no particular uses for it. The party is out of ideas, and its ideas guy is retiring.”

Ryan’s own future remains largely unwritten. In the Post interview, Ryan said he had not made plans beyond taking his wife on vacation in the new year — though he did toy with the notion of serving someday at U.S. ambassador to Ireland.

Zwick said Ryan will pursue private-sector opportunities while remaining engaged in the same issues he promoted in his political career, including tax and entitlement reform and poverty policy.

Upon assuming the speakership, Ryan knew he was probably forgoing a future presidential run given the volatility of that job. But he has not publicly ruled out any political opportunity, he remains one of the party’s most skillful fundraisers, and he carries that network with him out the door.

“He’s a young guy with a lot of people who support him. A lot of folks, including many donors, are wondering how they can keep helping him,” Zwick said. “I certainly hope he doesn’t close any doors.”