DENVER — John McCain campaigned Wednesday in Colorado for the seventh time since becoming the presumptive Republican presidential nominee, trumpeting an energy policy that appears to be resonating in this closely contested state.

On the stump and in a new television ad, McCain attacked Democratic candidate Barack Obama, accusing him of preferring to be an international celebrity over trying to lower gasoline prices at home.

"He says the high price of gasoline doesn't bother him, only that it rose too quickly," McCain told employees of Denver's Wagner Equipment, which sells and rents machines used in construction. "We ought to start drilling for more oil at home, including offshore. Senator Obama opposes that."

McCain's campaign unveiled a television ad attacking Obama that will air in Colorado and other battleground states including Iowa, Michigan, Ohio, Virginia and Wisconsin.

"He's the biggest celebrity in the world," a soft-voiced female announcer says as shots of Obama and tabloid celebrities Paris Hilton and Britney Spears flash across the screen. "But is he ready to lead? With gas prices soaring, Obama says no to offshore drilling. And says he'll raise taxes on electricity. Higher taxes, more foreign oil, that's the real Obama."

McCain's blasts came as he's battling to hold on to Colorado, a Republican state in recent presidential elections that's become increasingly Democratic in other races.

Democrats have taken over the governor's mansion, the state legislature and one U.S. Senate seat, and make up a majority of Colorado's delegation in the U.S. House of Representatives.

Sensing an opportunity to complete Colorado's flip, the party awarded Denver its national convention this year. Obama has set his sights on the state, with its upscale, young, ecologically conscious voters and growing Hispanic population.

"You can make the argument that Colorado is one of the two or three most important states in the country," said Peter Brown, assistant director of Quinnipiac University's Polling Institute.

"If McCain holds on to Colorado, you could argue that Obama would have trouble in Nevada and New Mexico."