Tony Blair, prime minister when the conflict began in 2003, was among the congregation, joining current PM Gordon Brown, former heads of the Army Sir Mike Jackson and Sir Richard Dannatt and former Defence Secretary Geoff Hoon.
The father of one soldier who died in Iraq refused to shake Mr Blair's hand after the ceremony.
Instead, Peter Brierley told the former PM: "I'm not shaking your hand, you've got blood on it."
Mr Brierley's son L/Cpl Shaun Brierley was killed in a road accident in Iraq 2003. Afterwards Mr Brierley said he thought Mr Blair was a "war criminal" who should not have been invited to the service.
He said: "I understand soldiers go to war and die but they have to go to war for a good reason and be properly equipped to fight.
"I believe Tony Blair is a war criminal. I can't bear to be in the same room as him", he added.
"I believe he's got the blood of my son and all of the other men and women who died out there on his hands."
About 120,000 members of the UK armed forces and civilians served in Iraq. British combat operations there officially ended on 30 April, with a ceremony in Basra.
Other senior royals, including Prince Charles, Prince William, the Duchess of Cornwall and the Princess Royal took part in the service, as did the Tory leader David Cameron and Liberal Democrat leader Nick Clegg.
Dr Williams said the conflict in Iraq would exercise historians, moralists and international experts for many years to come.
He said: "In a world as complicated as ours has become, it would be a very rash person who would feel able to say without hesitation, this was absolutely the right or the wrong thing to do, the right or the wrong place to be."
The Archbishop added that events had thrown up an important lesson - to avoid exaggerated rhetoric in the build-up to the war.
"Perhaps we have learnt something, if only that there is a time to keep silence, a time to let go of the satisfyingly overblown language that is so tempting to human beings when war is in the air," he said.
He blessed the centrepiece of the "Basra Wall", built by troops in front of the 20th Armoured Brigade's Iraqi HQ to honour fallen comrades.
The wall, with its brass plaques and marble centre stone, was the focal point of the memorial service in April to mark the end of the UK operation.
It is to be rebuilt at the National Memorial Arboretum in Staffordshire, with the help of a contribution from the Iraqi government.
The Defence Secretary, Bob Ainsworth, said the Archbishop had not criticised the government but agreed politicians should always carefully consider the consequence before going to war.
"I know that it's popular and fashionable to believe that MPs take these decisions lightly. They don't," he said.
"I never took the decision lightly before I voted on Iraq - I don't know of anybody else that did, from any party."
A candle was lit during the ceremony on behalf of those who lost their lives by Tracey Hazel, mother of Cpl Ben Leaning, 24, from Scunthorpe, Lincolnshire, who was killed when his armoured vehicle was hit by a roadside bomb in April 2007.
She said she felt "privileged and honoured" to perform the task.
She said: "At the end of the day, I wanted to be here for Ben and all the fallen - I feel so privileged.
"It was so nice they chose one of the parents to do it, as it's them that are left suffering when a loved one dies."
Prayers were read by representatives of each of the armed forces.
Capt Jon Pentreath, head of the Commando Helicopter Force which supported the Royal Marines' amphibious operations over five years, read a prayer on behalf of the Royal Navy.
He said the service would give personnel much-needed recognition.
"It's important for the nation to understand what members of the armed forces and their families are going through," he said.
Also involved was Sir John Chilcot, who is chairing the inquiry into the conflict.
He has invited those who served in Iraq to submit evidence to the inquiry, which is also hearing from bereaved families.
After the service, the Queen departed for Mansion House, for a lunch with veterans of the conflict.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.