Initial public reaction to the deficit-reducing deal reached by President Obama and Congress is fairly poor. Although there is some variance from survey to survey, on average approval of the deal registers at 38 percent against 49 percent disapproval across four national polls conducted on it so far.

The numbers are quite similar to polls conducted in 2010 on the Democrats’ health care bill, which almost certainly cost some Democrats their seats in Congress.

Unlike the health care bill, however, or the financial bailout in 2008, the debt deal was agreed to overwhelmingly by Congressional incumbents running in swing seats. Of the 63 Republicans running for re-election to the House in districts that the nonpartisan Cook Political Report deems competitive, 56 of them, or 89 percent, voted for the deal.

Democrats have fewer members running in swing districts in the House, simply because they lost so many of them in 2010. Still, among Democrats who are running in competitive races, the tally was 23-to-14 in favor of the bill, whereas the majority of Democrats in safe districts voted against it.

We get the same story if we look at the votein the Senate. All but two senators running in competitive races — Ben Nelson, Democrat of Nebraska, and Dean Heller, Republican of Nevada — voted for the bill.

One question is whether the members of Congress who voted for the bill did so because they actually thought it would be electorally advantageous — or because it was more in line with their ideological leanings. In both parties, the bill triggered more opposition from the wings than from moderates.

In the House, members of the liberal Congressional Progressive Caucus overwhelmingly voted against the bill, with 56 of the 70 members voted opposing it, while other Democrats voted for the bill by roughly a 2-1 margin. A 32-to-28 majority of Republicans in the Tea Party Caucus, meanwhile, voted for the bill — but they were less likely to do so than other Republicans in the House, who approved the bill by a 72-to-19 margin.

Since relatively few members of both the Tea Party Caucus and the Congressional Progressive Caucus are in competitive seats, the greater propensity of members in swing districts to support the bill could plausibly reflect ideological differences rather than differing views on electoral strategy.

For Republicans in the House, however, the differences persist even if you account for affiliation with the Tea Party. Among Republicans not affiliated with Tea Party, 91 percent of those in competitive districts voted for the bill, while 62 percent of those not running in competitive races did. Of the nine members of the Tea Party Caucus who are running in competitive races, meanwhile, seven voted for the bill — while a bare majority of Tea Party Caucus members serving in districts that are not expected to be competitive next November voted against it.

For Republicans, in other words, both ideological and electoral factors were in play. Relatively moderate Republicans were more likely to vote for the bill — but, also, those in competitive districts were more likely to vote for the bill than those in safe districts, even after controlling for this.

For Democrats, on the other hand, splits in the vote were primarily accounted for by ideological differences.

Around 80 percent of Democrats in the Congressional Progressive Caucus voted against the bill, while two-thirds of the remaining Democrats voted for it. Once this is accounted for, however, there were essentially no differences in the voting patterns based on district competitiveness. Excluding members of the Congressional Progressive Caucus, about two-thirds of Democrats in competitive seats voted for the bill — but so did about two-thirds of Democrats in safe seats.

So Democrats appear to have viewed the bill as something of a wash electorally, while Republicans in competitive districts seemed to go out of their way to vote for it.

There are a variety of plausible explanations for why Republicans voted this way. Districts which are competitive in the general election are not usually competitive in the primary, and vice versa. So the greater tendency of Republicans in competitive general election races to vote for the bill may have reflected a lack of concern about primary challenges, rather than some perceived advantage in the general election.

Still, the bill wound up passing the House with some margin to spare, 53 yea votes. In the Senate, all members running in competitive races could have voted against the bill and it would still have received the 60 votes necessary to overcome a filibuster.

When deals like this are reached, they usually poll well, at least initially. But it’s not hard to see why this deal is an exception. The process that led up to it was ugly, leading to record-high disapproval ratings for Congress in New York Times/CBS New polls and other surveys. (There is some evidence that this represents a real danger both to incumbents in general and to Republicans in particular.) And both the final deal, and all the deals that were proposed before it, were roundly trashed by partisans on all sides.

This is another way in which the debt ceiling debate resembled the health care debate. If voters spend months hearing overwhelmingly negative things about the various proposals, it’s going to be hard for them to turn on a dime and declare the deal that emerges to be a winner.

But it’s also worth keeping in mind that the final deal was not well aligned with public opinion. Voters overwhelmingly supported a mix of tax increases and spending cuts as part of the deal, something they did not get.

It’s true that, in general, tax increases don’t poll very well. Who knows how many elections Republicans have won over the years by campaigning against them. But the public’s views on this are not as monolithic as those of, say, Grover Norquist. The types of tax increases that were proposed as part of the deal, like higher rates for those making more than $250,000 per year, poll quite well — even among Republicans. And although the public might prefer spending cuts to tax increases, they prefer a mix of both to an imbalanced deal. It may be that members of Congress — but especially the Republicans in swing districts who were overwhelmingly likely to vote for the bill — relied on an oversimplified view of public opinion.

Instead, the reasons for the public’s objection to the bill are reasonably complex. It’s likely that at least some significant fraction of the public disliked the deal for the following reasons:

— The bill did not cut spending enough.

— The bill led to dangerous cuts in national defense.

— The bill led to dangerous cuts in Medicare.

— The bill weakened the economy, and failed to address the problem of job losses.

— The bill raised the debt ceiling without ensuring long-term fiscal stability, especially in entitlement programs.

— The bill played games with the full faith and credit of the United States.

— The bill failed to raise taxes on high-income earners, balancing the budget on the back of the poor.

— The bill opens the door to cuts in entitlement programs through the special commission.

— The bill opens the door to tax increases through the special commission.

— The bill represented a capitulation to the terrible, horrible, no-good Tea Party.

— The bill represented a capitulation to the terrible, horrible, no-good president.

Some of these objections, of course, are self-contradictory — and some have more of a ring of truth than others. But all are likely to make their way in some form into campaign commercials against members of Congress who voted for the bill, whether in the primaries or the general election.

This also gets at why an unpopular bill is likely to be more of a threat to members of Congress than to President Obama, even though he also endorsed the compromise. Challengers can pick and choose their critiques from this menu based on what might resonate the most in a particular district. But because the presidential campaign takes place at a national level, the Republican candidate will probably be limited to just a couple of these themes. There may nevertheless be some risk for Mr. Obama — but he’ll face less of a moving target. In addition, the polls suggest that the public tends to assign more responsibility for the deal to the Republican Congress than to the White House.

Nor is it clear that Mr. Obama’s support for the compromise will prevent Democratic challengers for Congress from running against it. Since Mr. Obama’s approval ratings are mediocre, his endorsement of the deal may even be a bug rather than a feature. Democratic candidates can run against the fairly unpopular Mr. Obama and the extremely unpopular Republican Congress at the same time.

Finally, keep in mind that critiques about the substance of the deal will come on top of critiques about the process — which will apply to virtually all incumbents, whether they voted for the deal or not.

Anti-incumbent sentiment is probably stronger now than at any point since polling began. We don’t know exactly how that is going to play out, and to some extent we are in uncharted territory.

But the polling so far suggests that the risks are particularly acute for Congress — and even more acute for the Republicans in Congress, who were more likely to vote for the bill and are being assigned more responsibility for it by the public.