There were no churches in the trenches, no kirks on the frontline of the First World War, but the faith was strong.

Both sides, the Allies and the Germans, believed God was with them and prayers had to be offered up for victory even amid the mud, blood and chaos.

On the British side, the chaplains held what became known as drumhead services: simple religious ceremonies conducted in front of an altar made from drums stacked on top of each other.

The drums were also usually draped with regimental colours, which added another symbolic, almost mystical element to the proceedings: for a soldier, then and now, colours are a rallying point, a comfort and an inspiration.

Such drumhead services are still conducted in the armed forces and, on Sunday, one will be held at Edinburgh Castle to mark the start of the Scottish commemorations of the First World War centenary. Around 9,000 people from all over Scotland will attend the service, which will evoke the traditional style of the drumhead service of the Great War.

Men and women from all three forces will march into the esplanade and form three sides of a square, leaving one side left open for the padre.

During the First World War, services such as this would have been held wherever they were needed: a barrack square perhaps, or even just a field near the trenches.

The place and manner of the service would have been carefully chosen so that it was easy for the troops to reach and easy for them to return to the action; it would also have been multi-denominational, as Sunday's service in Edinburgh will be.

The castle service will be conducted by padres from the three services and will feature military bands drawn from the Royal Navy, the Army and the Royal Air Force, supplemented by a choir.

The service, which will last around 30 minutes, will also be broadcast by BBC television and will be beamed down to a giant screen at the base of Arthur's Seat.

After the service, military bands will parade down the Royal Mile, followed by the congregation, in a procession to Holyrood Park, where a replica Commonwealth war graves cemetery will be built.

There will be more than 100 headstones representing names recorded in the rolls of honour at the Scottish National War Memorial. Sunday's event will mark the official start of the Scottish commemorations programme and was organised by the Scottish Commemorations Panel, which was appointed by the Scottish Government last year to recommend the right approach for Scotland's First World War events.

There have been some murmurings that Scotland did not need its own events because there are so many as part of the UK commemorations programme, but the idea of a drumhead service has proved popular.

The Reverend Norman Drummond, chairman of the Scottish Commemorations Panel and a former army chaplain, said it was important Scotland remembered the sacrifice of those who served during the First World War as well as the wider impact that the war had on Scotland and Scots around the world.

"The key objective has been to raise awareness in asking the question: what do we learn from all of this?" said Mr Drummond.

"The August 10 event will bring communities together to reflect the mood of the country as we went to war. The drumhead service will replicate ceremonies held in the battlefield, while the procession will reflect the mix of enthusiasm and ­apprehension felt by those who enlisted or waved their loved ones off to battle. The event will close with some time for quiet reflection and remembrance at Holyrood Park."

The service and procession will follow events happening in Glasgow today as part of the UK commemorations programme. A Commonwealth-themed service is being held at Glasgow Cathedral and will be attended by Prince Charles and led by the Reverend Dr Laurence Whitley, minister of the cathedral.

Later in the day, wreaths will be laid in George Square during an act of remembrance led by Glasgow's Lord Provost Sadie Docherty.

"Glasgow feels very honoured to play such a major role in Britain and the Commonwealth's commemoration of the centenary of the start of the First World War," she said.

"We hope that it will inspire everyone to investigate and learn about their own family's First World War story to ensure that we remember these stories for generations to come."