An Iraq war veteran has been arrested and charged with threatening to kill his officers after recording a violent rap protest song and sending it to the Pentagon.

Marc Hall, a junior member of an infantry unit, wrote the song in protest at the US army's unpopular policy of involuntarily extending soldiers' service and forcing them to return to Iraq or Afghanistan.

Hall completed a 14-month spell in Iraq last year, expecting to be discharged next month, but was told he would have to go back to Iraq under the policy known as stop-loss.

The song includes lines saying the army "fucked me over", and a warning that he would shoot his officers and "watch all the bodies hit the floor".

The army has charged Hall with threatening to "go on a rampage" and has ordered him to be held in a military prison in Georgia to await trial.

But the soldier's civilian lawyer, James Klimaski, said Hall was using the hip-hop genre, which often includes violent lyrics, to legitimately voice disgruntlement among troops at stop-loss. The stop-loss policy has forced 185,000 service personnel to stay in the military beyond their contracts to meet the demand over two wars. Klimaski said: "These lyrics don't mean anything. Gangsta rap songs are always talking about killing people. If you listen to what the song's about, not the specific lines, it's against stop-loss. And it's the anger of troops who go over and come back and go over again and come back in an unending war." .

Hall, who sings under the name Marc Watercus, directs his anger at officers. "Fuck you colonels, captains, E-7 and above. You think you so much bigger than I am? …" The song suggests he will round up the officers and put them against a wall. "I got a … magazine with 30 rounds, on a three-round burst, ready to fire down. Still against the wall, I grab my M-4, spray and watch all the bodies hit the floor. I bet you never stop-loss nobody no more."

Hall has issued a statement from military prison describing the song as free speech. He said he explained that the hardcore rap song "was a free expression of how people feel about the army and its stop-loss policy". He added: "The song was neither a physical threat nor any threat whatsoever … it was just hip-hop."

Kilmaski said Hall wrote the song last summer, a few months after returning from Iraq and about the time that soldiers in his unit became aware they would have to return to the Middle East. "The song was around the unit for a long time. They all talked with him about it. They didn't seem threatened before. But then it got close to going back to Iraq and they decided to put him in jail." .

What prompted Hall's arrest was his sending the song to the Pentagon, ­Klimaski said. "The alarm bells rang and they said, what's going on here?"

Hall's arrest came during a period of heightened sensitivity to threats within the army after officers were accused of ignoring warning signs before the killing of 13 people by Major Nidal Hasanin at Fort Hood in November.

The military said it had an obligation to investigate Hall's behaviour. "Anything less would be irresponsible to our citizens and soldiers," a representative said.

The Bush administration introduced stop-loss to ensure it had enough service personnel to fight the wars in Iraq and Afghanistan without enforcing a draft that would have been politically unpopular and brought home the true cost of the war to many people. Critics have described the policy as "involuntary servitude" and as a severe blow to morale. The military has said it will end stop-loss next year.