So we've now plunged into the turbid waters of the age-old expediency versus principle debate. Three times now in the space of a week, Barack Obama has departed from what would seem to be liberal principle: his refusal to accept public financing for the general election, his decision to vote for a bill that gives American telecoms retroactive immunity from prosecution for cooperating with the Bush administration's surveillance initiatives and his statement siding with the supreme court's conservative minority that on Wednesday voted to permit the death penalty for child rapists. Denunciations are ringing across the blogosphere.

We'll go through the issues individually. But the larger question here is about how far a candidate for president can go to inoculate himself against likely attacks – attacks that have a proven track record of working – before he's no longer the candidate you believed in a year ago.

On the issues in question: With regard to public financing, I think that only serious campaign-finance wonks have really complained about Obama's decision. Most people understand that if he opted in, he'd be sacrificing probably at least $200m, likely more. In addition, Obama's average contribution is $90, so, while he obviously has raked in his share of fat-cat money, he's also established, via the internet, a model of fundraising that's far more democratic and open to regular people of regular means. He should have been more honest in the way he talked about his decision, but, substantively, he did the right and necessary thing.

The other two matters get thornier. Few issues have rankled liberals – and constitutionalists, of which Obama is clearly one – like the Bush administration's arrogation of executive power, including its surveillance operations. Intense negotiations on the question of telecom immunity – that is, whether innocent parties could sue them on grounds that their privacy was violated – have been a sticking point for months. Democrats who wanted to remove immunity from the bill lost the fight, and last week the details of the final bill became public. Obama announced then that he'd be supporting the bill, with the immunity provisions. It passed the Senate today by 80-15 (Obama was out campaigning and missed the vote but of course was already on record as for it).

Obama says the bill has its good points, notably that it "firmly re-establishes basic judicial oversight over all domestic surveillance in the future." The operative word there is "basic", since the judicial review is mostly after-the-fact. The improvements over current practice are on the margins. It's not a good bill all-in-all, but given that only 15 senators opposed it, the Democrats obviously didn't have anywhere near the votes to get a stronger bill.

On the Supreme Court decision, Kennedy v Louisiana, most liberals are implacably opposed to the death penalty, and the idea of extending it to non-murderers is abhorrent to many people. So the sight of the Democratic nominee saying that the death penalty was an appropriate remedy in this case has been tough for some folks to swallow.

Tough for others to swallow is what Patrick Kennedy did. He repeatedly raped his eight-year-old stepdaughter, causing massive internal injuries. He left her to die, but her life was saved by multiple surgeries.

Substantively, Obama's position is in keeping with past statements. He's never been a blanket opponent of the death penalty, supporting it in cases where "the community is justified in expressing the full measure of its outrage." One can disagree with that position, and I do. But it's kind of hard to argue that a crime like Kennedy's isn't deserving of the full measure of outrage.

But here's the thing. Kennedy is African-American. It's pretty easy to envision the attack ad that could be made against Obama if he'd taken the position here some liberals wanted him to take. An image of Kennedy appears on the screen, photo-shopped to make him look terrifying. Sinister music swells. The voiceover intones: "Barack Obama wants criminals like Patrick Kennedy to have a chance to go free so they can rape children again." And so on.

That one ad, aired repeatedly in the right states, could in my view change the election. We know that ads like that have worked wonders for the GOP in the past. Yes, the political circumstances have changed since Mike Dukakis's time. But have they changed that much? I don't think so. And I can't blame people working in a campaign for deciding not to take that chance.

Liberals don't have to be happy about these decisions, and those who want to attack Obama and hold his feet to the fire and so forth should do so to their heart's content. But it's worth remembering that a presidential campaign is one of the worst contexts in which to expect or demand ideological consistency.

Obama has, in fact, taken a number of strong stands that might hurt him. He did back the supreme court on habeas corpus rights for non-citizen detainees – not a popular position. He's against offshore oil drilling while polls are showing that majorities support it. His is a position that could harm him in the crucial state of Florida, but he's taken it. He'll presumably continue to stand his ground on opposing the federal gas-tax repeal, a position John McCain might choose to revive at some point. And he will have to defend this fall his support for increasing the capital gains tax by up to 10%, as he will assuredly be attacked for that. He supports a large cap-and-trade scheme on carbon emissions that will surely be attacked as a tax on business. And so on.

I've always objected to setting up principle as a value that's oppositional to winning. To me, winning is a principle. It's the highest principle there is. If you win the election, you can do at least some of the good things that will improve people's lives in the country and around the world. If you lose it, you can't do any of them.

People will naturally disagree on which compromises are necessary and which ones aren't. What people shouldn't disagree on is that some are. The man's not running for president of Hyde Park.