(CNN) -- Britain was withdrawing its troops Sunday from Iraq, ending a role that began with the 2003 U.S.-led invasion to topple Saddam Hussein, British defense officials said.

The announcement that Britain was withdrawing its 170 troops came days earlier by Liam Fox, the defense secretary, who said the troops had completed their mission to train Iraqi naval forces.

"We now look forward to a strong, long-term defense relationship with Iraq," Fox told the House of Commons when he announced Wednesday that British troops would leave the country.

The announcement effectively ended Britain's role in Iraq, a role that was widely unpopular in the United Kingdom. About 179 British troops were killed during operations in Iraq.

Hundreds of thousands took to the streets in Britain when the war began, protesting the deployment of British troops to join then-President George Bush's "Coalition of the Willing." At the height of the war, more than 46,000 British troops were deployed primarily in and around the southern port city of Basra.

In 2009, Prime Minister Gordon Brown ordered an inquiry into the UK's participation in the war.

Former Prime Minister Tony Blair testified during the inquiry that Iraq needed to be confronted over its ambitions to develop weapons of mass destruction.

Britain ended its combat operations in Iraq in 2009 but maintained a small contingent, primarily members of the Royal Navy, to train Iraqi sailors and marines at the southern Iraqi port city of Umm Qasr. The remaining 150 or so military personnel were temporarily withdrawn in July 2009 after the Iraqi parliament failed to pass an agreement for their continued presence.

Britain will leave behind a small contingent to protect its personnel at its embassy in Baghdad. Additionally, Fox said a small number of British troops will continue in a NATO training mission in Iraq.

CNN's Chelsea J. Carter contributed to this report.