UPDATE 5pm: Prime Minister Julia Gillard has declared the Commonwealth leaders meeting in Perth over as she thanked leaders for their messages of condolence over the deaths of three diggers in Afghanistan.

She made her remarks at the closing of the three-day summit today, saying it had achieved important changes including reform of the Commonwealth organisation itself.

''We over the last few days have shared some moments of joy like the opening ceremony, we also shared together some moments of sorrow too,'' Ms Gillard said.

''I thank you for your expressions of condolence to the Australian people this morning on the losses we have sustained overnight in Afghanistan,'' she told Commonwealth leaders at the close of the final executive session.

An Afghan National Army soldier gunned down and killed three Australian members of Mentoring Task Force 3 as they were on morning parade at a forward operating base at Shah Wali Kot in Kandahar province yesterday morning local time.

Seven other Australian soldiers were wounded.

Ms Gillard said she believed the summit had ''got a lot of good work done'' and had achieved change on issues such as food security, child vaccinations and climate change.

She said the CHOGM had also achieved change by reforming the Commonwealth organisation to make it stronger and able to pursue the values it was founded on.

Leaders failed to agree on a controversial proposal to appoint a Commonwealth commissioner on democracy, human rights and the rule of law.

A CHOGM communique was released later today and was to be followed by a press conference later in the day.

Commonwealth Secretary-General Kamalesh Sharma told the gathered leaders it had been a ''remarkably productive meeting'' and he thanked Ms Gillard for her ''skilful and effective chairing'' of the meeting.

''It has been a challenging agenda given the strong focus on reform but I believe the issues have been addressed in a comprehensive, balanced and effective manner.''

Ms Gillard thanked the Queen for the time she spent with Commonwealth leaders in Perth, saying she remained ''at the heart of what unites as a Commonwealth''.

The Prime Minister also thanked West Australian premier Colin Barnett and the people of Perth for doing Perth, WA and the nation proud in hosting CHOGM.

Defence Minister Stephen Smith today said the killing of three Australian troops by an Afghan soldier would "send a shockwave" through the community and the Defence Force.

It was the equal worst day for Australia since sending troops to Afghanistan in 2001, with seven soldiers also wounded.

Two of the dead soldiers had been involved in the Queensland floods rescue earlier this year.

"Today is a bitter day for Australia," Prime Minster Julia Gillard said earlier.

The soldiers were members of mentoring task force 3 who were training Afghan National Army counterparts.

Defence Force Chief General David Hurley said the next of kin have been notified but names have not yet been released.

"Our troops in Afghanistan are in shock and they are in pain. But they are tough and they are resilient," he said. "I know in these difficult circumstances they will find the strength and determination to continue their mission and to honour their mates."

General Hurley said the first soldier killed was a Corporal on his first deployment to Afghanistan. He served on Operation Flood Assist in Queensland earlier this year.

The second soldier was a Captain on his second tour of Afghanistan. He also worked on Operation Yasi Assist earlier this year.

The third soldier was a Lance Corporal who served three tours of East Timor and was on his first tour of Afghanistan.

An Afghan interpreter was also killed.

Seven soldiers were injured - one has life-threatening wounds, four have severe wounds and two have minor wounds. The most seriously wounded are likely to be moved to Germany.

Mr Smith said it was “a terrible blow for our nation".

It brings to 32 the number of Australian soldiers killed in Afghanistan - 11 of them this year.

The number of wounded now stands at 209, including 43 this year.

Mr Smith said the Australian community "quite rightly questions our commitment to Afghanistan" but it remained in Australia’s national security and national interest to be there and stare down international terrorism.

"We’re not there forever, we don't want to be there forever, but if we were to leave now that would run the risk of creating a vacuum and all of the work that has been done over too long a period would be lost," Mr Smith said.

General Hurley urged people “not to jump to conclusions" and said an extensive investigation was under way.

The shooter had been a member of the Afghan National Army. He was not part of the parade. General Hurley said the reasons for the shooting were not known.

Earlier this year Lance Corp Andrew Jones was killed by an Afghan soldier. Last year three soldiers were killed and seven wounded when a Blackhawk helicopter crashed.

Afghan troops at the base have been disarmed and confined to barracks.

"We are taking the necessary steps to protect our Australian personnel on the ground in Afghanistan but it is critical that we show restraint and reserve our judgments until the investigation is complete," General Hurley said.

"It is difficult to find words to express our profound sorrow and sense of loss at this time."

Mr Smith said Australia was "not in Afghanistan forever" and despite terrible setbacks was on track for Afghan army to take control of security by 2014.

"It will not be a surprise that in the aftermath of any fatality, particularly a multiple fatality like this with very tragic circumstances, that the immediate reaction of the Australian people will be to question our ongoing commitment to Afghanistan. I understand that."

"Our very strong view is that if we were to leave now we would run the risk of creating a vacuum in which the Taliban...remnants of al Queda would again fall, creating precisely the sort of danger we are there to stare down.

The Afghanistan-Pakistan border are would again become a breeding ground for international terrorism."

General Hurley had recommended the deployment and Mr Smith had approved it and told Parliament about it two weeks ago.

Greens Leader Bob Brown expressed his "great sadness" at the deaths and repeated his call for the troops to come home immediately.

“The Greens join all Australians in offering condolences to their family and friends, and comrades in Afghanistan, as they deal with this terrible tragedy. They will all be remembered in Australia’s archives for their courage and commitment to our nation,” he said.

“The Greens call again for Australia’s defence force personnel to be brought home to Australia, without delay."

Originally published as PM thanks leaders for Digger messages