The Defence Force has launched an urgent investigation after Australian soldiers serving in Afghanistan posted racist messages and apparently insulted Prime Minister Julia Gillard on their Facebook pages.

In one message, a soldier serving in Afghanistan refers to locals as "sand niggaz" and "dune coons", and jokes about running them over with his vehicle.

Acting Chief of Army Paul Symon told the Seven Network last night that he was shocked by the messages, some of which appeared to refer to Ms Gillard as a "fuckin ranga" and mocked former Prime Minister Kevin Rudd.

One soldier has posted a photograph of an Afghan street, while other soldiers have posted derogatory comments beneath it, including one which suggests the first soldier should have beaten an Afghan with his rifle, known as "butt stroking"

"Last but not least, the poof riding the girl's bike [you] should have stuck a stick in his spokes then butt stroked him. He didn't do anything, just pisses me off. Happy shooting!" the comments reads.