Australia's Chief of Defence Angus Campbell has conceded the country's involvement in the Afghanistan war will be "painted in hues" in the history books.
The last remaining Australian troops are preparing to leave Afghanistan by September, drawing the 20-year conflict to a close.
General Campbell said Australia's contribution to the NATO-led mission had helped thwart terrorism and bring security and stability to Afghanistan.
Australia went to Afghanistan in 2001 following the 9/11 terror attacks.
More than 39,000 Australian Defence Force members have served in Afghanistan, including a peak of more than 1500 in 2012.
There have been 41 Australians killed in the war, while countless others have returned with physical injuries and mental wounds.
Allegations of war crimes have also been levelled against some elite Australian soldiers, including the murders of more than two dozen Afghan civilians.
"The story of Australia's longest war is already being written," General Campbell told a Senate hearing on Tuesday.
"This chapter in our nation's military history will be painted in different hues."
General Campbell said it would be coloured in part by the allegations of unlawful conduct, which are being examined by a special investigator.
But he hopes it will be understood from the perspective of a broader canvas, including the acts of bravery and valour by Australian troops and their partner agencies in Afghanistan.
Asked about the security situation in Afghanistan, General Campbell said drawdown decisions were based on the assessment the conflict was not going to be resolved militarily.
He said negotiations involving the Taliban would be necessary to see peace return to the country.
Afghan security forces are still fighting throughout the country, particularly in traditional strongholds of the Taliban and its partner organisations.
"We see a continuing level of violence in the country," General Campbell said.
"This is very much going be a negotiated settlement."
He played down the prospect of the Taliban rapidly seizing control once coalition troops leave Afghanistan.
"Australia remains committed to supporting Afghanistan even as we draw our focus to the challenges within our region."
Labor senator Penny Wong pressed officials on the decision to close Australia's embassy in Kabul.
Foreign Affairs Minister Marise Payne confirmed the government considered a number of options before cabinet decided to close the embassy.
Senator Payne said with the departure of international troops, it was determined risks to the embassy would significantly increase and "mitigations" would not be able to reduce the threats to an acceptable level.
The minister said future options for Australia's diplomatic presence were a matter of ongoing discussions with other allies.
Senator Wong raised concerns about visa pathways for Afghan nationals who worked for the Australian government, including local interpreters and staff.
Lifeline 13 11 14
Open Arms 1800 011 046