The threat of terrorist attacks has cast a long shadow over the Olympic Games since the Munich massacre in 1972, then the Olympic Park bombing at Atlanta in 1996. The 7/7 bombing in London just a day after the city won the 2012 bid triggered an extra £514 million to be poured into enhanced venue security, from bringing in armed service personnel to deploying surface-to-air missile launchers on high points around the city.
But security for recent Games never faced quite as much scrutiny as the Sochi Winter Olympics, not least because Sochi borders Russia's troubled North Caucasus, a breeding ground for separatists who have carried out several recent terrorist attacks. In the run-up, a number of threats were directly attributable to the event, and Chechen rebel leader Doku Umaro specifically urged his fighters to target it.
In January, gang members and militants attacked a restaurant in Makhachkala, Dagestan with a hand grenade, then detonated a car bomb when police arrived. Shortly afterwards security forces killed seven suspects in shoot-out at a nearby house. This followed two blasts in the southern city of Volgograd at the end of December 2013 in which 34 people died, leading to security forces detaining more than 700 people. A video claiming to feature the men responsible was posthumously posted online issuing direct threats against the Sochi Games.
Security procedures began in earnest a month before the opening ceremony - on 7 January 2014 around 40,000 police and interior ministry troops were deployed to limit access to the area around Sochi. There were immediate concerns that the cordon may not have been impenetrable - security forces issued an alert in the Sochi area for the widow of a Dagestani terrorist believed to present a direct threat.
Regional risk at the Sochi Olympics
One man who followed the run-up to the Sochi Games with a keen interest is Dr Neil Melvin, head of the Stockholm International Peace Research Institute's (SIPRI) new Conflict and Peacebuilding in the Caucasus project.
Sales of weapons and military services by the 100 largest arms-producing companies fell by 4.2% in 2012.
"All Olympics may be the target of international terrorism, but as we've seen in this case, there's a regional dimension with the various insurgencies going on very close to the Sochi Games," says Melvin. "There have already been attacks which people are associating with the Games in Volgograd and a declaration by some of the insurgent groups in the North Caucasus that they would attack the Olympics. The other dimension is the impact of the Games had on the wider security and conflict situation in the region. With so much focus put on protecting the Games from the outside, the Games itself risked having an impact on those conflicts."
While security has been high for all recent Games, the risk at Sochi was elevated because of its location, and militants may have sought out any targets that they felt would bring attention to their cause.
"We've seen some groups in the North Caucasus do extreme violence, for example when they took the school hostage in Beslan leading to many children being killed," says Melvin. "They may try to target legitimate regime targets, but finding them heavily protected end up doing general terror strikes against easier targets like they did in Volgograd where they blew up a bus and a station, not even close to Sochi."
Although Sochi itself may have been a key target of violence, with 40,000 security personnel around the Games venues, there was an increased risk of attacks in other parts of Russia linked to the Games, which, given the size of Russia, were all but impossible to police.
Security measures for the 2013 Winter Olympics
While the London 2012 Games reassured the public about security measures being put in place by making public details of actual contracts for related hardware and services, Russia was a little more recalcitrant.
"They admitted some investments," says Melvin. "There was this mysterious boat floating around off Sochi and no one seemed to know what was on it, but there was a lot of speculation that they've invested heavily in electronic intelligence. They put in place a network so that all telecommunications will be monitored; any internet traffic or telephone signals around the Sochi area are going to be monitored closely."
But not all measures were perhaps as well thought out.
"They put security checkpoints at every hundred metres at certain points, which they made in white, perhaps in anticipation there'd be snow, but there isn't any, so you can spot these white hideouts on the brown hillside really easily," remarks Melvin.
The additional security challenge Sochi faced over London was that the increased state presence and oppression in the region could have caused additional grievances over and above the long-standing regional disturbances.
"In Dagestan, which is the most dangerous part of the Caucasus, authorities were trying to develop a dialogue with the militants and begin a reintegration and reconciliation process, but that stopped and they moved on to rounding everybody up and shooting them ahead of the Games as they moved to clamp down," says Melvin.
"We don't know if this may cause reprisals. London was a bit different to that - unless the people in the East End were going to rise up. Some people were a bit upset, but not to that level."
And while the human security presence may be significant, Russian security does not have the strongest track record, particularly when it comes to collateral damage, such as in the Moscow theatre hostage crisis which led to the deaths of 133 hostages alongside 40 militants.
"This may be a little bit different because the eyes of the world will be on Sochi and Putin has made this his personal project, so anything that happens would come back to him and he may find it hard to shift the blame on to others," comments Melvin.
Despites all these concerns Russia's security response broadly won international approval.
"I think they've done a pretty good job. The US said that they've been stepping up their intelligence cooperation, and FBI personnel travelled to Russia ahead of the Games, and other participating countries have been cooperating in the security operation."
Given current US-Russia relations are not in the best shape, it caused quite a stir when the US offered air assets and two ships to support the security services in Sochi. While it could have been perceived as a mischievous offer, US Ambassador to Russia Michael McFall had worked closely worked on Games security with his Russian counterparts.
Berenice Baker spoke to Denis Edgar-Nevill, chair of cybercrime forensics with the British Computer Society (BCS), about potential cyber threats to the Games and how the government is planning ahead.
"The US had to make sure its athletes were fully secure and they take that seriously," says Melvin. "The offer would never have been accepted, because Russia wanted to be sure that it could look after security independently, and they've always been very discouraging about having US ships in the Black Sea, which they see as their space."
While a hush has now descended over the ski slopes and skating rinks of Sochi, the Games formed part of Russia's long-term goal to bring wealth and tourism to the region. How likely is it that one fortnight of winter sport could sow the seeds of regional reconciliation?
"It's an enormous gamble," says Melvin. "They even have plans for 10 tourist resorts across the Caucasus. If you need 40,000 troops to defend Sochi, while expensive ski resorts would bring in a lot of jobs, it's such an easy target. If the militants want to attack anybody, the slopes aren't going to be easy to defend, and who wants to go on a skiing holiday to Dagestan in the middle of a war?"
And the benefits may line pockets somewhat remote from the North Caucasus.
"Some people who are sceptical about this see this as an opportunity for companies close to the Kremlin to make money through corrupt building deals, when it should be spent on delivering real solutions," suggests Melvin.
Russian security forces may be congratulating themselves on a Games that passed without incident, but the true test of the legacy of the Sochi Winter Olympics will come years down the line if it is viewed as the trigger to improve peace and security in the region.
"The Games went smoothly and I think there may be some immediate improved feelings, but in the long term they will have very little impact in a positive sense," says Melvin. "Some of the security measures are going to cause grievances that will feed into this problem. With militancy rising and the militarisation of the South Ossetian border, the conflict is interlinking north and south. It's hard to imagine the Russians would take that away after the Games."
"I think those fences and border posts are there for good. A militarised international border has been created and that may be one of the legacies of the Games," concludes Melvin.