Sgt Gareth Thursby and Pte Thomas Wroe, both of 3rd Battalion The Yorkshire Regiment, were killed last Saturday at a checkpoint in the Nahr-e Saraj district of Helmand province.
Their bodies were flown back to the UK on Thursday. The Royal British Legion held a memorial service for the men in Warminster, where the men were based.
Married father-of-two Sgt Thursby, 29, and Pte Wroe, 18, were shot dead by a man dressed as a local Afghan policeman who pretended to be injured so they would help him.
Sgt Thursby, from Skipton and Pte Wroe, from Meltham, near Huddersfield, were killed near the end of their six-month deployment.
Today's service took place at the Wiltshire town's Minster Church.