RIO DE JANEIRO — I can't help but feel optimistic as I travel on Rio's shiny new "Linha 4" (line 4) subway, between the southern part of the city and the Olympic village in the Barra da Tijuca neighborhood. The long-promised subway extension actually exists, the escalators are working, the lights are on and trains are running as planned. The Bus Rapid Transit system (BRT) is also alive and kicking, all buses have functioning windows and wheels, the engines aren't melting and the roofs remain firmly in place.

As I reach the Olympic Village, I see the biggest surprise of all: The stadiums, too, are actually here. They exist, they're impressive and imposing, and they were finished in time for the games. Wow, did we really pull this off?

"Pull what off, you idiot," I find myself thinking just moments later, as the bus leaves the futuristic site and heads towards the old neighborhood of Engenho de Dentro, crossing through the innermost section of the city. Olympic Rio quickly gives way to a grittier Rio. Outside the window, I'm looking at Curicica, not far from the "City of God," but this might as well be Caracas or Islamabad. As Brazilian rapper Mano Brown once said: "The outskirts of a city are outskirts no matter where you are."

Its colors and yellow-clad staff make the BRT look like an alien capsule, against the ochre-and-grey construction site backdrop. Every now and then, we drive past an armored vehicle with armed soldiers around it. I came to see an Olympic event but I feel like I've ended up in an episode of Homeland.

A number of us get off at the Magalhães Bastos station to take a train. Both sides of the station are surrounded by troops. On the platform, too, soldiers, some very young and visibly frightened, are patrolling. The train arrives and it's packed. We stand out with our pasty white skin, and the passengers already on it stare at us with a mixture of amazement and hostility. Peddlers also enter the cars, trying to sell drinks. "Gringos" usually try to avoid making eye contact with them.

Watching the opening ceremony on TV in Rio's Mangueira favela on Aug. 7 — Photo: Liu Bin/Xinhua/ZUMA

On the other side of the car, I spot a military jacket and, I admit, feel a bit relieved — that is, until I realize it belongs to another peddler.

"Your phone's battery is dead and you're stuck on the train? Here, just plug this in! It works just like in the movies! Five reais ($1.5) only! Five reais!"

A few moments later, another peddler in military clothing: "Check out my potatoes! Potatoes, onions and parsley for two reais only!"

Where could these jackets have come from? Are they leftover from the military patrols of the FIFA World Cup? The Rio+20 conference? Were they exchanged for mattresses? Potatoes? As part of a truce with drug traffickers or militias? For a Brazilian, it's impossible not to think about the soldiers who fought in the War of Canudos 120 years ago and joined former slaves once they returned to Rio in founding the city's first favela.

I finally reach my destination, the Olympic Stadium. I'm again surprised to see that it, too, actually exists. Its seats are all there, as are the flags of all countries, flapping around the stadium. On the pitch, the Brazilian women's soccer team defeats China 3-0. A crowd of 27,000 people sing "Brazil! Brazil! Brazil!" and my optimism returns. There's word of widespread disorganization, but maybe the Olympics are actually working.

That thought alone is enough to make me sad again. It might well be that over the next two weeks, the Olympics are the only thing that will work properly in this country. The rest, outside of the Olympic capsule, will go on as usual, God willing. And at least from what can be seen in western Rio, the Lord isn't intent on giving.