While harsh ads and negative attacks are a staple of presidential campaigns, Sen. John McCain has drawn an avalanche of criticism this week from Democrats, independent groups and even some Republicans for regularly stretching the truth in attacking Sen. Barack Obama’s record and positions.

Obama has also been accused of distortions, but this week McCain has found himself under fire for a pair of headline-grabbing attacks. First, the McCain campaign twisted Obama’s words to suggest that he had compared Sarah Palin, the Republican vice-presidential nominee, to a pig after Obama said, in questioning McCain’s claim to be the change agent in the race, “You can put lipstick on a pig; it’s still a pig.” (McCain once used the same expression to describe Sen. Hillary Clinton’s health plan.)

Then, he falsely claimed that Obama supported “comprehensive sex ed” for kindergartners (he supported teaching them to be alert for inappropriate advances from adults).

Those attacks followed weeks in which McCain repeatedly, and incorrectly, asserted that Obama would raise taxes on the middle class, even though analysts say he would cut taxes on the middle class more than McCain would, and misrepresented Obama’s positions on energy and health care.

A McCain ad called “Fact Check” was found to be “less than honest” by FactCheck.org, a nonpartisan group. The group complained that the McCain campaign had cited its work debunking various Internet rumors about Palin and implied in the ad that the rumors had originated with Obama.

“The last month, for sure, I think the predominance of liberty taken with truth and the facts has been more McCain than Obama,” said Don Sipple, a Republican advertising strategist.

Indeed, in recent days, McCain has been increasingly called out by editorial boards, as well as independent analysts like FactCheck.org. The group, which does not judge whether one candidate is more misleading than another, has cried foul on McCain’s campaign more than twice as often since the political conventions as it has on Obama’s.

A McCain spokesman, Brian Rogers, said the campaign had evidence for all its claims. “We stand fully by everything that’s in our ads,” Roger said, “and everything that we’ve been saying we provide detailed backup for — everything, and if you and the Obama campaign want to disagree, that’s your call.”

For a candidate who came into the race promoting himself as a truth-teller, and who has long publicly deplored the kinds of negative tactics that helped sink his candidacy in the Republican primaries in 2000, the turnaround has been startling.

“They just keep stirring the pot, and I think the McCain folks realize if they can get this thing down in the mud, drag Obama into the mud, that’s where they have the best advantage to win,” said Matthew Dowd, who worked with many top McCain campaign advisers when he was President Bush’s chief strategist in the 2004 campaign, but who has since had a falling out with the White House. “If they stay up at 10,000 feet, they don’t.”

Indeed, for all the criticism, the offensive seems to be having an impact. It has been widely credited by strategists in both parties with putting Obama on the defensive since it began earlier this summer.

Some of those who have criticized McCain have faulted him for not only the blatant nature of some of the untruths, but also for failing to correct himself when errors are pointed out.

Even on “The View” on Friday, co-host Joy Behar grilled him about his new ads. “We know that those two ads are untrue,” she protested. “They are lies. And yet you, at the end of it, say, ‘I approve these messages.’ Do you really approve them?”

“Actually they are not lies,” McCain responded crisply, “and have you seen some of the ads that are running against me?”

Obama’s hands have not always been clean in this regard either. He was called out earlier in the campaign for saying, incorrectly, that McCain supported a “hundred-year war” in Iraq after McCain said in January that he would be fine with a hypothetical 100-year American presence in Iraq, as long as Americans were not being injured or killed there.

More recently, Obama has been criticized for ads that have incorrectly accused McCain of not supporting loan guarantees for the auto industry — a hot topic in Michigan. He also has taken McCain’s repeated comments that U.S. economy is “fundamentally sound” out of context, leaving out the fact that McCain almost always adds at the same time that he understands that times are tough and “people are hurting.”

But sensing an opening in the mounting criticism of McCain, the Obama campaign released a withering statement after McCain’s appearance on “The View.”

“In running the sleaziest campaign since South Carolina in 2000 and standing by completely debunked lies on national television, it’s clear that John McCain would rather lose his integrity than lose an election,” Hari Sevugan, a spokesman for the Obama campaign, said in a statement.

The strategy reflects a calculation McCain’s advisers made earlier this summer — above the strenuous objections of some of the longtime hands who helped McCain build his “Straight Talk” image — to devote the campaign heavily to disqualifying Obama in the eyes of voters.

The ads are devised to draw the interest of bloggers and cable news producers to shift the debate onto its own terms questioning Obama’s character and qualifications, often with disputed claims. Sipple voiced concern that McCain’s approach could backfire.

“Any campaign that is taking liberty with the truth and does it in a serial manner will end up paying for it in the end,” he said. “But it’s very unbecoming to a political figure like John McCain whose flag was planted long ago in ground that was about ‘straight talk’ and integrity.”