The deployment in Northern Ireland is the longest in British army history [GALLO/GETTY]

Nearly 40 years of British military presence in Northern Ireland will come to an end at midnight on Tuesday when the army formally ends its operations in the province.

A low-key flag-lowering ceremony at a barracks in the County Antrim area will be the only official event marking the end of Operation Banner the army's longest continuous deployment.

During its 38 years, more than 300,000 personnel have served in the operation and 763 have lost their lives and 6,000 were injured.

The formal cessation of the military's activities is seen as another milestone in Northern Ireland's transition to peace.

From Wednesday only a 5,000-strong regular garrison will remain in the province. The troops will not be on active service and can be deployed anywhere in the world.

Troops were first deployed in 1969 to help restore order after sectarian riots between Protestants and Roman Catholics. During the most serious fighting with paramilitaries up to 30,000 soldiers were deployed on the streets.

Bloody Sunday

Officially, the armed forces' mission in the province was to help the police defeat "terrorism" and maintain order to help in "returning Northern Ireland to normality".

Catholics broadly welcomed the soldiers at first, but opinion soon turned amid accusations of bias and troops were soon the target of attacks by the Irish Republican Army (IRA).

In 1972, British paratroopers shot dead 13 men during a civil rights march in an incident known as Bloody Sunday, one of the key events in The Troubles, as Northern Ireland’s violence was known.

The last soldier killed was shot dead at a roadblock in 1997.

The 1998 Good Friday Agreement between Northern Ireland's political factions and the British and Irish governments largely ended the 30 years of violence.

The change has been marked with a service of remembrance for the fallen soldiers at St Anne's Cathedral in Belfast.

The move will have little impact on the ground as the army began to scale down its role in 2005.

New era

Colonel Wayne Harber, deputy commander of 39 Infantry Brigade  - the last operational brigade in the province - said: "The ending of Operation Banner is a moment for reflection.

"The great thing is the ending of the conflict in Northern Ireland and the optimism with which the people look forward to the future; we share that optimism."

Bob Ainsworth, the British armed forces minister, said in a statement to MPs that the change marked the beginning of a new era.

"We should take this opportunity to remember the commitment, bravery and sacrifice of all those who have served over so many years in helping deliver the current, more settled and more optimistic circumstances."

Source: Agencies