epa05033123 Speaker of the House, Republican Paul Ryan, holds a news conference on Capitol Hill in Washington DC, USA, 19 November 2015. Ryan spoke on immigration and Syria. US President Barack Obama has threatened to veto a House Republican-led bill requiring intelligence officials certify that each refugee is not a threat to the US. EPA/MICHAEL REYNOLDS (Michael Reynolds/EPA)
Opinion writer

The recent terrorist attacks have called forth predictable demands from our nation’s politicians, particularly President Obama’s opponents, for U.S. leadership in the world. Here’s what these politicians don’t talk about: the image of our country they themselves create in the way they manage — or mismanage — the work of governing.

For several years now, we have not done ourselves any favors.

The often chaotic budget and debt-ceiling battles between the president and congressional Republicans (along with a great deal of demagoguery on immigration, race and Islam) have inspired little confidence among either friends or foes that we can manage even our own affairs.

The coming mid-December deadline for reaching a budget agreement should thus be seen as more than just another inning in a long fiscal game. Congress has an opportunity to show that it takes all this world leadership talk seriously. It needs to demonstrate that even though the voters have given the presidency to one party and control of Congress to the other, we are still capable of being at least a functional democracy.

At the great risk of overestimating our politicians, there is a good chance that they might pass the test. Merely writing such a sentence produces instant shivers of doubt, but this time, political calculation may be on the side of good government.

The way for a sensible outcome was opened by then-House Speaker John Boehner’s final good deed when the Ohio Republican championed an agreement last month (passed largely with Democratic votes) on overall government spending levels and a two-year debt-ceiling increase. The fights ahead involve some arguments over how to apportion the sums agreed upon and even bigger disagreements over a series of “riders.” These are provisions Republicans want to attach to the budget to undercut various Obama administration policies, particularly on the environment and financial regulation.

Senate Majority Leader Mitch McConnell (R-Ky.) has been pushing hard for the riders, but he has the much higher priority of keeping his job by making it easier for Republicans to hold on to the Senate in next year’s elections. Many of the most vulnerable Republican seats are in bluish states (among them Wisconsin, Illinois, Pennsylvania and New Hampshire), and budget shenanigans would go down very badly in these places, as would regulatory bows to Wall Street and attacks on environmental rules . He will curtail his demands accordingly.

In the House, Speaker Paul Ryan (R-Wis.) is still being given room to maneuver by right-wing Republicans who never gave the same leeway to Boehner. A stately march to a budget agreement would let Ryan add to his largely positive collection of media reviews.

Shockingly, there is even a chance of modest progress on behalf of some of the poorest and most vulnerable Americans. Negotiators are working on what would be a genuinely bipartisan compromise to make a series of provisions in Obama’s original stimulus program permanent. These have expanded the earned-income tax credit that helps Americans with low incomes and created a child tax credit that has the same effect. The measures were set to expire in 2017, and if they did, some 16.4 million Americans (including 8 million children) would either be pushed into poverty or thrust even more deeply into a poverty they are already experiencing.

In exchange for locking in these credits, Democrats would agree to make permanent the research and development tax credit and other business tax breaks that Congress typically extends anyway.

Memo to Speaker Ryan: This is a smart deal for you. Business would be happy to have its bennies for good, and you could finally put some money on the table to back up your rhetoric about caring for poorer Americans. Memo to liberals: This is a step forward, since business always wins those tax breaks anyway.

Writing optimistically about politics is dangerous these days, so here is the requisite “to be sure” paragraph:

Yes, Republicans could try to use the budget to continue their misguided efforts to block Syrian refugees. But there is a fair chance that a few weeks will cool passions and open the way for a more humane and sensible approach to keeping Americans safe. Some Republicans may still insist on dealbreaking riders. But the realists among them should realize that the changes they seek will be achieved only by winning the presidential election — a cause they would set back by picking their fights now.

Everyone says we need to stand strong against terrorism. The first step is to avoid the self-inflicted wounds of self-defeating politics.

Read more from E.J. Dionne’s archive, follow him on Twitter or subscribe to his updates on Facebook.