Two men held on suspicion of murder and supplying class A drugs were freed as inquiries continued.
Capt McMahon was said to have been in the Special Reconnaissance Regiment (SRR), an elite Army intelligence unit.
After service with 42 Commando, he is believed to have carried out surveillance work in Helmand province, Afghanistan, in 2006.
Defence officials sent their condolences to his relatives.
Police began a murder probe after Capt McMahon was found gravely ill in Banstead, Surrey.
A force statement said: “Police were called by South East Coast Ambulance Service who were attending an address in Banstead where a man was suffering an apparent medical episode at around 7.05am on August 26.
“Sadly, despite the best efforts of paramedics, the man was pronounced dead at the scene. He has been formally identified as Chris McMahon, a 40-year-old.
“Two men were arrested on suspicion of murder and supplying Class A drugs; they have been released on bail. An investigation to establish the circumstances around Chris’ death remains ongoing.”
The SRR was established in 2005 and is part of the UK’s Special Forces. Members undertake a wide range of classified reconnaissance and surveillance operations, mainly involving counter-terrorism.
It is understood it was set up to relieve the existing Special Air Service and the Special Boat Service from carrying out such duties against the Taliban, al-Qaeda and other radical groups.
The regiment, comprising 500 to 700 soldiers, was formed around a core of personnel taken from the long-established 14 Intelligence Company which performed a similar role against the Provisional IRA in the Troubles in Northern Ireland.
Based in Hereford, its Colonel in Chief is the Duchess of Cornwall.
The MoD would not confirm if Capt McMahon was serving with the specialist unit.