The United States consumes a quarter of the world’s oil, and much of that comes from countries that aren’t friendly to us. Meanwhile, we have a military that increasingly marches on oil, to the point where long convoys must cross dangerous territory to deliver fuel for troops in vehicles that get 3 miles a gallon.

Two top military leaders told state senators that the armed forces are taking energy issues seriously — by working on ways to make their operations at home and abroad more efficient.

The testimony, at the Scripps Institution of Oceanography, was part of a hearing by a state Senate committee on climate change designed to gather more information on how energy use affects national security.

Getting more oil within the United States is not a solution, said retired Vice Adm. Dennis McGinn, a consultant on energy security issues.

“We cannot drill our way to sustainable prosperity and security,” he said.

And because oil is a commodity, deciding to avoid buying it from countries that don’t like us doesn’t solve the problem, because other people will.

Whenever we gas up, he said, “part of that money inevitably is getting to states that fund terrorism.”

Oil extraction in developing countries causes instability between haves and have-nots, he said, showing a slide of an impoverished fishing village next to an oil terminal in Nigeria.

And global warming can lead to fights over scarce resources like arable land.

“The pressure of climate change, left unchecked, will create many more Darfurs,” he said.

For the Marine Corps, a big issue is making sure that fighting forces are supplied with the fuel and energy they need to move around and communicate, said Maj. Gen. Anthony M. Jackson, who commands Marine Corps Installations West, including Camp Pendleton.

“It is critical to those Marines and soldiers to accomplish the missions this country sends them on,” he said.

Modern warfare has increased energy use dramatically. Fighting vehicles have to be heavier to survive roadside bombs and as a result, use more fuel.

Troops are equipped with GPS, night-vision goggles, radios and other devices, all with batteries that must be charged.

“It is energy-intensive,” Jackson said.

Half of the tonnage in supply lines, he said, is fuel, and nearly a third is water. Getting fuel into a place like Afghanistan makes it cost about $15 a gallon, and that jumps dramatically, to $400, to get it to troops in forward operating bases.

To deal with that, the Marines are looking at using water purifiers and solar chargers, plus making their vehicles more efficient, he said.

The Navy, meanwhile, is also working on lowering its energy usage, said Rear Adm. William French, commander of Naval Region Southwest. He oversees installations in California and Nevada, where conservation efforts have reduced energy usage by 18 percent since 2003.

The Navy is working on using biofuels in new ships, he said, plus generating power from the sun and the wind on its bases.

The state’s climate change laws — designed to reduce the amount of greenhouse gas emissions — are under attack from politicians who say they should be put on hold until the economy recovers.

The Democratic senators who put together yesterday’s hearing, Christine Kehoe of San Diego and Fran Pavley of Agoura Hills, disagree.