* Islamic State dig trenches around natural gas tanks

* Refinery contested despite hundreds of air strikes

* Iraqi security forces trapped in refinery

* Graphic: http://link.reuters.com/wux64w

BAGHDAD, May 13 (Reuters) - Islamic State militants have dug trenches around natural gas and hydrogen tanks at Iraq's largest refinery, raising the stakes in a battle where the price of victory may be the refinery itself.

The Baiji refinery remains contested despite more than 300 coalition air strikes in the vicinity since the Islamist insurgents overran the area last June.

The militants launched their fiercest attack on the installation last month and now control large parts of the complex in which 200 Iraqi security forces are trapped.

The Pentagon last week said the outcome of the battle -- in which Iraqi security forces backed by coalition warplanes are fighting to retake the refinery from Islamic State militants -- could not be predicted but warned it was going in "the wrong direction".

Islamic State appears to have committed itself to an all-out fight there, proving it can still seize the initiative after being ejected from the city of Tikrit further south in early April, military officials and experts say.

The battle highlights the disordered state of the security forces, which partly disintegrated last summer and must now fight on several fronts whilst holding ground they have retaken.

"We don't sleep that much," said Mohanad, one of the policemen trapped inside the refinery. They are fending off two or three attacks a day from the militants, who are using snipers, mortars and heat-seeking missiles.

"They (Islamic State) have dug trenches near the hydrogen and natural gas tanks. Aircraft cannot hit them because it is very dangerous and we could get killed too."

Islamic State's fixation on the refinery invites comparisons with the Syrian town of Kobani, which the militants spent months trying to take from lightly armed Kurdish guerrillas.

The insurgents were eventually defeated after hundreds of U.S. air strikes, but the town was ruined.

"They are maintaining their momentum just like Kobani; they keep throwing people at the refinery," said an Iraqi security source speaking on condition of anonymity. "The only difference is that Kobani is a city and Baiji is an industrial facility, and it's difficult to manage a fight inside an area that is surrounded 360 degrees."

For Islamic State, the value of the refinery, which has not been working since last June, is mainly symbolic, although the group may be able to siphon off some crude oil and fuel from storage tanks, analysts and officials say.

The latest fighting has inflicted damage that will take years to repair, rendering the refinery idle at a time when Iraq is short of cash due to plummeting oil prices.

Michael Knights, fellow at the Washington Institute for Near East Policy, said it would be difficult to salvage the refinery as a functioning facility.

"It's regrettable we have to lose the refinery but now that ISIS has committed itself to another one of these anvil type battles -- the hammer's in the air -- they've done it Kobani and they bled themselves white".


The battle for Baiji however could have the effect of delaying the much anticipated operation to retake the city of Mosul from Islamic State.

The refinery was liberated once before in November, but security forces failed to secure the area and deployed to other fronts, leaving the refinery a soft target.

"They handed it over to weak army units that crumbled under pressure," said the Iraqi security source.

Baiji is flanked to the west by open desert all the way to Syria, making it easy for Islamic State to re-supply. The Hamrin mountain range to the east is a militant stronghold.

Military commanders say the key to retaking the refinery this time is to control the nearby towns of Baiji and Siniya.

"We have to retake Siniya and Baiji towns to cut all supply routes coming from Anbar province and used by Daesh to send reinforcements whenever they need," said a source in the Salahuddin Operations Command. Daesh is another name for Islamic State.

"What's the point of retaking a location and suffering casualties while nearby areas and supply routes are still controlled by Daesh"

Coalition planes have dropped ammunition and aid to the forces inside the refinery, but troops have so far failed to reach the complex.

Government forces started a military operation last week from the west, but encountered strong resistance from Islamic State snipers and roadside bombs. Meanwhile federal police, army and a small contingent of Shi'ite paramilitaries are trying to advance into the town of Baiji south of the refinery, but have not managed to reach the centre.

The mayor of Baiji said the government forces were no match for the resources Islamic State had committed to the battle.

"What we see on the ground is a modest number of forces compared within the ongoing build-up of Islamic State inside the town and also the refinery," said Mohammed Mahmoud al-Jubouri.

Military officials also complain of poor coordination between regular forces and paramilitary groups organised under the umbrella of the Hashid Shaabi (Popular Mobilisation).

"Hashid fighters are not reporting to the military command, and their local leaders normally take decisions without consulting the army commanders," said a colonel whose regiment is fighting near the refinery, describing the situation as "chaotic".

The head of the Salahuddin Operations Command was recently replaced - a move one source within the command said had further weakened the chain of command.

"This decision created divisions within the operations command and affected everything else on the ground".

(Reporting by Baghdad Bureau; Editing by Giles Elgood)