Islam Times reports from AFP: Gillard said Afghanistan should never again become a safe haven for extremists and her government was committed to standing by the nation's most important ally, the United States, in the long-running conflict.
"This means more fighting, more violence, it risks more casualties. There will be many hard days ahead," Gillard said in her first address to national parliament on the war.
The prime minister said while Australia's key mission in Afghanistan, to train an Afghan National Army brigade in restive Uruzgan, was expected to take between two and four years, Canberra's involvement would extend beyond this.
While the Afghan government was expected to take over responsibility for security by 2014, the international community, including Australia, would remain engaged beyond that date, she said.
"There will still be a need for Australians in a supporting role. There will still be a role for training and other defence co-operation. The civilian-led aid and development effort will continue," Gillard said.
"We expect this support, training and development task to continue in some form through this decade at least."
The war in Afghanistan has bipartisan political support in Australia, which has some 1,550 troops in the country, but the government is facing increasing public pressure as the war stretches on amid mounting casualties.
Gillard, who was briefly heckled by people in the public gallery during her speech, said her commitment to Afghanistan was not open-ended, and Canberra wanted to bring its troops home as soon as possible, but success was critical.
"Australia will not abandon Afghanistan, we must be very realistic about the future," she said. "Transition will take some years, we will be engaged through this decade at least."
Australia joined the US-led war effort in Afghanistan in the months following the 9/11 attacks in the United States, but withdrew its soldiers in December 2002 as the situation stabilised.
Canberra sent special forces troops back in September 2005 to target key insurgents and ramped up its efforts from October 2008 as it took on a growing role in training and mentoring Afghan soldiers in the country's south.
Conservative opposition leader Tony Abbott said leaving Afghanistan now would be an insult to the families of the 21 Australian soldiers who have died in the conflict.
"A premature end to our involvement would tell the Americans and the British that Australia is an unreliable ally and fair-weather friend," he told parliament.
"It would tell the Afghan people that our commitment to human rights is more rhetorical than real and certainly doesn't extend to protecting them where we can."
The debate, agreed as part of a deal with the Greens which ensured Gillard's centre-left Labor Party could form a government after deadlocked August polls, will continue Wednesday when dozens of MPs are expected to voice their views.
Greens lawmaker Adam Bandt and independent Andrew Wilkie, both of whom support Gillard's fragile coalition government, are expected to urge the withdrawal of troops.