The head of the U.S. Olympic Committee says his priority is to keep American athletes safe, striking a balance between safety and encouraging them to move around Sochi. (Reuters)

Hard by a rushing river, a sniper’s nest lies tucked away in the bushes alongside the brand-new railroad that connects the two main Olympics sites. Camouflaged sentry posts follow the route for its entire 30 miles. Behind a wall, far out of town, a compound of army tents houses some of the tens of thousands of personnel who have come here to provide security. A parking lot in the forest holds hundreds of police cars.

President Vladimir Putin promised that Sochi would be safe for the Winter Olympics, and the Russian security effort is nothing short of gigantic. Legions of screeners and ID checkers control the flow of thousands of athletes, coaches, spectators, journalists, volunteers and workers. Police frisk every passenger heading for local commuter trains. Other police officers stand guard at every intersection surrounding the Olympics campus.

Behind them, unseen but ubiquitous, are the snipers, soldiers, missile launchers.

Construction delays continue to plague the effort here, even as competition began Thursday. But Russian officials say they are confident they have their security apparatus in place and functioning.

Friday evening is the first major test, with the Opening Ceremonies. But every day this week has offered a dress rehearsal of sorts for security. The Olympic torch, a potentially “soft” target, arrived Thursday without incident. Putin visited Wednesday. A run-through for the Opening Ceremonies on Tuesday brought thousands of invited spectators to the Fisht Olympic Stadium, every one of whom was closely checked in a process that went smoothly and efficiently.

U.S. warnings about explosive toothpaste tubes, first reported Wednesday night, were only the latest in a seemingly constant stream of dour security pronouncements involving the Winter Olympics. Russian officials say they follow up on every warning but insist there is no need to worry.

“I am sure that the security level in Sochi is no worse than in New York, Washington or Boston,” Deputy Prime Minister Dmitry Kozak told reporters Thursday. “All countries have a database about terrorists, and, based on the information we have received, Sochi is under no more threat than any other city on the planet.”

The U.S. government’s cautionary message about toothpaste, aimed at airlines with direct flights to Russia, involved fears that explosives could be mixed by terrorists once on board. Russia had already banned all liquids and gels in airplane cabins on domestic flights earlier this year.

For the crowds of people from dozens of countries who daily move between Olympic sites and surrounding areas of Sochi and the Krasnaya Polyana mountain base, the keep-you-on-your-toes security effort is omnipresent and obvious, but also hidden and sometimes unexpected.

Accreditation cards, which had to be applied for months ago, are checked and rechecked, by people and by machines. At important perimeters, airport-style X-ray scanners and metal detectors screen everyone and everything that enters.

Entire roads are accessible only to official buses and delivery vehicles.

The security guards in public areas are dressed in athletic-looking purple winter sports outfits and are unfailingly polite. Toothpaste, for them, is still not a problem, and they let it through.

The Russian host city for the 2014 Winter Olympics has palm trees? The Post's Max Fisher explains everything you need to know about the Olympic city. (Kate M. Tobey and Gillian Brockell/The Washington Post)

An apartment complex that is being used as a hotel for journalists is surrounded by a fence — and a moat. Along the perimeter fence at the airport, a soldier is posted every 50 yards, presumably to sound an alarm as much as to fight off attackers. Along a nearby pipeline, police agents are posted about every 10 yards.

The security effort here has not been modest, because Russia is a target of Islamist extremists, most from within its own borders. The regular scares involving unaccounted-for “black widows,” or rogue tubes of toothpaste, seem to help justify the relentless screening of Olympic visitors.

The gleaming but pokey train that connects Olympic Park to Krasnaya Polyana runs uphill through the valley of the rushing Mzymta River, crossing and recrossing the river on a series of bridges. Steep rock faces rise first on one side, then the other. On the ground, police officers keep watch on every bridge and tunnel.

At regular intervals, locomotives have been stationed on tracks alongside the main rails, and a rail crane sits halfway up the main line — all apparently on hand to clear out a stalled train as fast as possible.

A gondola takes visitors from the valley floor to a hotel cluster called Gorki 960. Anyone wandering around for too long who doesn’t look like a tourist or a construction worker can expect a kindly gentleman to approach and offer assistance.

Back down on the coast, a ride on a municipal bus into the downtown section of the Adler district reveals a much different scene. The people who live there are going about their lives without any overbearing interference by security agencies. Only residents’ cars are supposed to be permitted inside Sochi during the Olympics, but license plates reveal autos from all over Russia — formerly war-torn Chechnya included.

Residents by now have gotten used to police officers who are unable to give directions because they have just arrived from somewhere like Novosibirsk. But when the driver of crowded Bus 125 said he had no idea where the post office was — it’s at the main intersection in town, right by the principal bus stop — and then drove past the stop because he apparently did not recognize it, that was too much for the passengers.

“Who’s this guy working for?” was the gist of their shouted inquiries, because the driver clearly was not a qualified local fellow. Peevishly, he let everyone out in the middle of the next block, where they had to clamber over a fence to get out of the way of onrushing traffic.

Kathy Lally contributed to this report.