By January 1915 it had become evident to the BEF at the Western Front that the Germans were mining to a planned system. As the British had failed to develop suitable counter-tactics or underground listening devices before the war, field marshals French and Kitchener agreed to investigate the suitability of forming British mining units. Following consultations between the Engineer-in-Chief of the BEF, Brigadier George Fowke, and the mining specialist John Norton-Griffiths, the War Office formally approved the tunnelling company scheme on 19 February 1915.
Norton-Griffiths ensured that tunnelling companies numbers 170 to 177 were ready for deployment in mid-February 1915. In the spring of that year, there was constant underground fighting in the Ypres Salient at Hooge, Hill 60, Railway Wood, Sanctuary Wood, St Eloi and The Bluff which required the deployment of new drafts of tunnellers for several months after the formation of the first eight companies. The lack of suitably experienced men led to some tunnelling companies starting work later than others. The number of units available to the BEF was also restricted by the need to provide effective counter-measures to the German mining activities. To make the tunnels safer and quicker to deploy, the British Army enlisted experienced coal miners, many outside their nominal recruitment policy. The first nine companies, numbers 170 to 178, were each commanded by a regular Royal Engineers officer. These companies each comprised 5 officers and 269 sappers; they were aided by additional infantrymen who were temporarily attached to the tunnellers as required, which almost doubled their numbers. The success of the first tunnelling companies formed under Norton-Griffiths' command led to mining being made a separate branch of the Engineer-in-Chief's office under Major-General S.R. Rice, and the appointment of an 'Inspector of Mines' at the GHQ Saint-Omer office of the Engineer-in-Chief. A second group of tunnelling companies were formed from Welsh miners from the 1st and 3rd Battalions of the Monmouthshire Regiment, who were attached to the 1st Northumberland Field Company of the Royal Engineers, which was a Territorial unit. The formation of twelve new tunnelling companies, between July and October 1915, helped to bring more men into action in other parts of the Western Front.
Most tunnelling companies were formed under Norton-Griffiths' leadership during 1915, and one more was added in 1916. On 10 September 1915, the British government sent an appeal to Canada, South Africa, Australia and New Zealand to raise tunnelling companies in the Dominions of the British Empire. On 17 September, New Zealand became the first Dominion to agree the formation of a tunnelling unit. The New Zealand Tunnelling Company arrived at Plymouth on 3 February 1916 and was deployed to the Western Front in northern France. A Canadian unit was formed from men on the battlefield, plus two other companies trained in Canada and then shipped to France. Three Australian tunnelling companies were formed by March 1916, resulting in 30 tunnelling companies of the Royal Engineers being available by the summer of 1916.
171st Tunnelling Company was formed between February and March 1915 of a small number of specially enlisted miners, with troops selected from the Monmouthshire Siege Company of Royal Engineers.
171st Tunnelling Company was first employed in March 1915 in the Hill 60/Bluff areas at Ypres. The Germans held the top of Hill 60 from 16 December 1914 to 17 April 1915, when it was captured briefly by the British 5th Division after the explosion of five mines under the German lines by the Royal Engineers. The early underground war in the area had involved both the 171st and 172nd Tunnelling Company.
In July 1915, 171st Tunnelling Company moved to Ploegsteert and commenced mining operations near St Yves at the southern end of the Messines ridge. The four deep mines at St Yves, charged with a combined load of 146,000 pounds (66,000 kg) of ammonal, formed part of the mine galleries that were dug by the British 171st, 175th, 250th, 1st Canadian, 3rd Canadian and 1st Australian Tunnelling companies as part of the prelude to the Battle of Messines (7–14 June 1917), while the British 183rd, 2nd Canadian and 2nd Australian Tunnelling companies built underground shelters in the Second Army area.
In December 1915, 171st Tunnelling Company began work on the deep mine at Trench 127 at St Yves. The mine consisted of two chambers (Trench 127 Left, Right) with a shared gallery. The name indicates the British lines where the initial shaft was dug, not where the mine was placed under the German positions. The shaft was completed to a depth of 25 metres (82 ft) within four weeks, however after driving a 310 metres (1,020 ft) gallery the Royal Engineers faced a sudden inrush of quicksand and a concrete dam had to be constructed. A new attempt was made, and by April 1916 the Trench 127 mine was ready, with the ammonal charges over 400 metres (1,300 ft) away from the initial shaft.
At the end of January 1916, 171st Tunnelling Company began mining operations at La Petite Douve Farm. The farm, located next to the road from Messines to Ploegsteert Wood, was enclosed by a German trench system known as ULNA. Also at this point was a junction on the narrow gauge railway system which ran from the forward areas of Messines to the rear areas around Nieuwkerke. This operation was characterized by setbacks. Difficult geology lead to two mines being abandoned before completion, and after a charge of 23,000 kilograms (50,000 lb) of ammonal had been put in place beneath the farm, the gallery was discovered by a German counter-mining operation on 24 August 1916. Three days later the German miners blew a heavy charge, which shattered about 120 metres (400 ft) of the main gallery and killed four men engaged in repairs. This camouflet wrecked the British gallery completely and forced the Royal Engineers to abandon the tunnel, which then quickly flooded.
At the end of February 1916, 171st Tunnelling Company began work on the deep mine at Trench 122 at St Yves. The mine consisted of two chambers (Trench 122 Left, Right) with a shared gallery. The name indicates the British lines where the initial shaft was dug, due west of where the crater is today. The area was dominated by a complex of German trenches and by mid-May first charge of 9,100 kilograms (20,000 lb) of ammonal was in place at Trench 122 Left. Another shaft (Trench 122 Right) was started part way along the original tunnel and after another 200 metres (660 ft), a charge of 40,000 lbs of ammonal was placed by the Royal Engineers beneath the ruins of Factory Farm which sat on the German front line.
In April 1916, 171st Tunnelling Company moved to the Spanbroekmolen/Douve sector facing the Messines ridge. At Spanbroekmolen, 171st Tunnelling Company took over from 3rd Canadian Tunnelling Company and extended the work to the German lines, driving the tunnel forward by 523 metres (1,717 ft) in seven months until it was beneath the powerful German position. At the end of June 1916 the charge of 41,000 kilograms (91,000 lb) of ammonal in 1,820 waterproof tins was complete, the largest yet laid by the British. With the mine complete, the British selected two additional objectives to be attacked near Spanbroekmolen, Rag Point and Hop Point, which were 820 metres (2,700 ft) and 1,100 metres (3,500 ft) from the main tunnel. A branch was started and inclined down to 37 metres (120 ft) depth. By mid-February 1917 the branch had been driven 350 metres (1,140 ft) and passed the German lines. At that point, the German counter mining activities damaged 150 metres (500 ft) of the branch gallery and some of the main tunnel. The British decided to abandon the branch gallery because aggressive counter-mining would alert the Germans to the presence of a deep-mining scheme. On 3 March the Germans blew the main tunnel with a heavy charge laid from their Ewald shaft, leaving it beyond repair and resulting in it being cut off for three months. The British started a new gallery alongside the old main tunnel which after 357 metres (1,172 ft) cut into the original workings. Mining was greatly hampered by the influx of gas, several miners being overcome by the fumes, but eventually – and only a few hours before the appointed time of detonation at 03:10 a.m. on 7 June 1917 – the ammonal charge was ready again and secured by 120 metres (400 ft) of tamping with sandbags and a primer charge of 450 kilograms (1,000 lb) of dynamite. The Spanbroekmolen mine exploded 15 seconds late, killing a number of British soldiers from the 36th (Ulster) Division, some of whom are buried at Lone Tree Cemetery nearby.
While employed at Spanbroekmolen, 171st Tunnelling Company also took over work on the nearby deep mines at Kruisstraat. Work there was begun by 250th Tunnelling Company in December 1915, passed to 182nd Tunnelling Company, then to 3rd Canadian Tunnelling Company and 175th Tunnelling Company, which took charge in April 1916. When the gallery reached 320 metres (1,051 ft) it was handed over to 171st Tunnelling Company. At 489 metres (1,605 ft) a charge of 14,000 kilograms (30,000 lb) of ammonal was laid and at the end of a small branch of 166 feet (51 m) to the right a second charge of 14,000 kilograms (30,000 lb) was placed under the German front line. This completed the original plan, but it was decided to extend the mining to a position under the German third line. Despite meeting clay and being inundated with water underground which necessitated the digging of a sump, they managed to complete a gallery stretching almost half a mile from the shaft in just two months, and a further charge of 14,000 kilograms (30,000 lb) of ammonal was placed. This tunnel was the longest of any of the Messines mines. In February 1917, German countermeasures necessitated some repair to one of the chambers and the opportunity was taken to place a further charge of 8,800 kilograms (19,500 lb) marking a total of four mines, all of which were ready by 9 May 1917.
At the end of January 1917, the 171st Tunnelling Company began work on the deep mine at Ontario Farm. The ground at the site selected for this mine proved very difficult as much of it was sandy clay. The miners began to dig at Boyle's Farm which is just on the southern side of the main road (Mesenstraat/Nieuwkerkestraat) passing by. The shaft went down 30 metres (98 ft) and pumps were installed to bring air down and water out of the mine. After tunnelling forward, the miners broke into blue clay, extending the depth to some 40 metres (130 ft). After driving the gallery almost 200 metres (660 ft) forward, the flooding was so bad that a dam had to be constructed and a new gallery started. Despite these obstacles, the tunnellers arrived under Ontario Farm at the end of May 1917 and installed the 27,000 kilograms (60,000 lb) ammonal charge with a day to spare. When it was detonated on 7 June 1915, the mine did not produce a crater but left a shallow indentation in the soft clay; the shock wave did great damage to the German position. The explosion caught two battalions of the 17th Bavarian Infantry Regiment during a relief, half of which were "as good as annihilated".
The mines at Messines were detonated on 7 June 1917, creating 19 large craters.
The 171st Tunnelling Company stayed in the Ypres Salient and moved near the village of Zonnebeke, where it constructed the Vampire dugout (known locally as the Vampyr dugout). Vampire was built to house a brigade headquarters of up to 50 men and one senior commanding officer. Located close to Polygon Wood, it was named after the supply soldiers whose mission was to come out at night to re-supply troops in the front line.
At the end of the Third Battle of Ypres/Battle of Passchendaele (31 July–10 November 1917), having retaken Passchendaele ridge, the British were left with little natural shelter from the former woods and farms. The artillery of both sides had literally flattened the landscape. Needing shelter for their troops, the Allied High Command in January 1918 moved 25,000 specialist tunnellers and 50,000 attached infantry who had been preparing and taking part in the Battle of Messines north in the Ypres Salient. There they dug almost 200 independent and connected structures at depths of 30 metres (98 ft) into the blue clay, which could accommodate from 50 men, to the largest at Wieltje and Hill 63 which could house 2,000. The level of the activity can be gauged by the fact that by March 1918, more people lived underground in the Ypres area than reside above ground in the town today. Connected by corridors measuring 6.5 feet (2.0 m) high by 4 feet (1.2 m) wide, they were fitted with water pumps to deal with the high groundwater table.
Created 14 metres (46 ft) below Flanders by the 171st Tunnelling Company, and dug over a period of four months, the engineers used I beams and reclaimed railway line in a D-type sett structure. This was then further reinforced, using stepped wooden horizontal beams. The Vampire dugout became operational from early April 1918, first housing the 100th Brigade of the British 33rd Division, then the 16th King's Royal Rifle Corps and then the 9th Battalion Highland Light Infantry Regiment. After only a few weeks, the dugout was lost when the Germans undertook the Battle of the Lys in April 1918. It was recaptured in September 1918, when its last occupants became the 2nd Battalion of the Worcestershire Regiment.
In March 1918, the 171st Tunnelling Company constructed a deep dugout in the centre of Zonnebeke, located directly beneath the ruins of the parish church. This dugout was only discovered after the Second World War during archaeological excavations of the Augustinian abbey. Today the outline of this dugout is marked in an archaeological garden within the church grounds, and a model of the church dugout can be seen at the "Memorial Museum Passchendaele 1917" in Zonnebeke.
Shortly after the completion of the Vampire dugout, 171st and several other tunnelling companies (173rd, 183rd, 184th, 255th, 258th and 3rd Australian) were forced to move from their camps at Boeschepe in April 1918, when the enemy broke through the Lys positions during the Spring Offensive. These units were then put on duties that included digging and wiring trenches over a long distance from Reningelst to near Saint-Omer. The operation to construct these fortifications between Reningelst and Saint-Omer was carried out jointly by the British 171st, 173rd, 183rd, 184th, 255th, 258th, 3rd Canadian and 3rd Australian Tunnelling Companies.