Thousands of carefree sun-worshippers packed Rio de Janeiro's Ipanema beach on a recent sunny day, some just soaking up the rays, others playing volleyball and soccer — a postcard scene framed by lush mountains.
A short drive away, about 100 police troops were storming the city's biggest slum, trading gunfire with drug traffickers in an operation that left 2,000 school children without classes.
More so than Madrid, Tokyo and Chicago, the three cities it beat to secure the 2016 Olympics, Rio is a place of extremes with a daily capacity to delight and disturb.
The “Marvellous City”, as its residents never tire of calling it, is blessed with mountains, forest and beaches that can take even a seasoned traveller’s breath away.
The six million Cariocas, as Rio residents are known, have a warmth and passion that explodes in their fierce soccer rivalries and during Carnival — the raucous annual festival that unites rich and poor in a blur of Samba and Bacchanalia.
Increasingly overshadowed as an economic and cultural hub by the southeastern city of Sao Paulo in recent years — Brazil's largest and most populous — Rio is showing signs of a revival.
Its finances are in the black for the first time in years thanks to a competent state government, and the discovery of one of the world's biggest oil reserves off its coast promises a flow of investments and jobs in the coming years.
Yet Brazil’s former capital remains sharply divided between the world of about 1,000 slums spread throughout the city and that of the “asphalt” — the slum dwellers' term for the paved roads of middle-class areas.
Copacabana beach, Sugarloaf mountain and the Christ the Redeemer statue on a towering peak overlooking the city are all squeezed into the wealthy, narrow strip of Rio’s South Zone. Beyond that, much of the Rio tourists rarely see is a sprawling jumble of lower middle-class areas and slums with little or no state presence.
Many of the more than one million slum dwellers are caught in the middle of a brutal war between drug traffickers who rule the “favela” with impunity and a police force that tends to shoot first and ask questions later.
The police, whose tactics are regularly condemned by human rights groups, shoot dead an average of about three people a day, often young, black youths from favelas, who are uniformly classified as “resisting arrest”.
Visitors can go for weeks in Rio oblivious to the drug war, but the signs of problems are there to see in the desperate street kids who roam tourist areas begging and sniffing glue from plastic bags.
Still, Rio is making efforts to become more inclusive and has benefited from Brazil's economic progress.
Several favelas are receiving federal public works money to build apartments and health centres, while an experiment in community policing has taken hold in several others.
Rio’s new mayor, Eduardo Paes, has embarked on a “Shock of Order” campaign since taking office early this year, making a serious effort to rein in Rio's unruly elements including a chaotic transport system and thousands of unlicensed vendors. “We are going through same process that many US cities went through in the 1980s and 90s,” Paes said.
In the downtown Lapa district, a revival has been under way for years as investments have helped transform what was a shady area into Rio's most vibrant nightlife scene.
Young Cariocas pack its Samba bars every weekend to dance and down caipirinhas -- the delicious Brazilian-rum drink. If all else fails, there are always the beaches — the playgrounds where Cariocas unfailingly flock at the first glimpse of sun.