Melbourne: Prime Minister Julia Gillard made a surprise visit to Afghanistan and met the Australian troops stationed there, days after three of her nation's troops were shot dead by a Afghan soldier.

During her stop-over in the country on her way back from the G20 in Cannes, Gillard also met Afghan President Hamid Karzai.

She flew into Tarin Kowt to share a barbecue lunch with some of the 1,550 Australian soldiers stationed in the southern Camp Holland base.

Her visit came just days after three Australian soldiers were killed when an Afghan National Army soldier opened fire at a base in southern Kandahar province.

Seven other soldiers were wounded in the incident, which was Australia's worst since three commandos were killed in a helicopter crash in 2010.

"I wanted to spend some time trying to see this place through your eyes as we are planning the next phase of what happens here in Afghanistan," she said.

"I thought it was important to come and touch base and to see what is happening here and to hear directly from you about what the world looks like through your eyes."

She held talks with coalition commanders and local Afghan officials before going on to meet Karzai in Kabul.
Gillard, according to a report, opened the new Australian embassy in the capital, and praised diplomatic staff for their work in dangerous conditions.

Afghan foreign minister Zalmai Rassoul says Australia has made invaluable contributions to his country.

"For all these achievements, and others, we will always remain grateful to the people of Australia for their sacrifice in blood and treasure over the years to help us build a secure, stable, democratic Afghanistan," he said.

Gillard said Australia would be engaged in Afghanistan for the long term.

"We came to Afghanistan and we have found some tremendous days of sorrow, but we have also found a great friendship," she said, adding "We do intend to stay engaged here with you, in a spirit of friendship, for the long term."

(Agencies)