An attack that killed 35 revelers in an Istanbul nightclub cast a shadow on New Year celebrations attended by millions of people around the world Saturday to ring in 2017.
The massacre, which also wounded at least 40 more people as panicked clubgoers jumped into the Bosphorus, stoked fears that large crowds of people cramming into major cities to celebrate the New Year could present a target for violent extremists.
Sydney kicked off celebrations - under tightened security around the globe - attended by some 1.5 million people with a spectacular fireworks display that lit up its iconic harbour.
Crowds in Hong Kong also flocked to the waterfront to watch fireworks explode over Victoria Harbour, while in Japan thousands packed the streets of Tokyo to release balloons into the air.
Celebrations swung into Europe with the night sky over Moscow's Red Square literally painted red by the fireworks.
And around half a million people thronged Paris's famous Champs-Elysees, where the Arc de Triomphe was lit up with a colourful countdown to 2017 and the word "welcome" in dozens of languages.
Under the watchful eye of some 2,000 military police, around two million people watched a fireworks display on Rio de Janeiro's Copacabana Beach that while impressive was shortened this year due to a severe economic crisis.
The raucous celebrations drew to an end a year of political shocks, from Britain's vote to leave the European Union to the election of maverick leaders in the United States and Philippines.
It has also been a year of celebrity deaths from David Bowie to Prince and Mohammed Ali.
2016 was also a year of bloodshed and misery that has seen the war in Syria, Europe's migrant crisis and numerous terror attacks dominate the headlines.
The violence continued on Saturday, with twin bomb blasts killing at least 27 in a busy market area in central Baghdad.
But this did not stop people from flooding the streets of the Iraqi capital to celebrate and families in evening dress headed to swanky hotels for parties.
Fadhel al-Araji, a 21-year-old from the Sadr City neighborhood, already had his beer in the back of his car.
"Tonight is about fun... Everybody can do what they want and nobody cares. We need a night like this, Iraq needs it," he said, behind the wheel of his beat-up Toyota.
In the shattered Syrian city of Aleppo, 20-year-old student Abdel Wahab Qabbani was also determined to see in 2017 in a positive frame of mind.
"The last two years, I didn't go out for New Year. This time, I'm going to party," he said.
The Gulf emirate of Dubai marked the new year with its usual gigantic pyrotechnics off the world's highest skyscraper, Burj Khalifa, as well as other landmarks.
This year's celebration passed without problems, unlike last year when a fierce blaze broke out at a nearby tower.
But revelers did have to contend with reinforced security measures and a heightened police presence.
There were some 2,000 extra officers in Sydney after a man was arrested for allegedly making online threats against the celebrations and garbage trucks were deployed to block any attempt to plow a vehicle into the crowd.
Following a deadly attack on a Berlin Christmas market on December 19, the German capital beefed up security, deploying extra police, some armed with machine guns.
"This year, what's new is that we will place concrete blocks and position heavy armored vehicles at the entrances" to the zone around Brandenburg Gate, said a police spokesman.
However, visitors seemed undeterred by recent events as they began to gather under a freezing Berlin sky for a series of concerts ahead of a large midnight fireworks display in the area.
Paris saw fireworks again, after muted 2015 celebrations following the massacre of 130 people by jihadists in the French capital.
Nearly 100,000 police, gendarmes and soldiers were deployed across France.
Brussels reinstated its fireworks show after last year's was cancelled at the last minute due to a terrorist threat.
In London, more than 100,000 people lined the banks of the River Thames to watch a spectacular 12-minute fireworks display set to a soundtrack featuring music by Bowie and Prince.
Mayor Sadiq Khan proclaimed that despite the vote for Brexit, "London is open to the world." An estimated 3,000 police, including armed officers, were deployed on the streets of the capital for the event.
With more than a million people expected to turn out to watch a giant ball drop in Times Square, New York is deploying 165 "blocker" trucks and some 7,000 police.
"It's the best place in the world to be on New Year's Eve," said Alma Alanis, a young lawyer from Mexico with her companion, Eduardo Chavarria.
Normally boisterous Bangkok was seeing in the new year on a more sombre note as the nation grieves for King Bhumibol Adulyadej, who died in October.
Nevertheless, revelers will at least get one extra second to enjoy the night's festivities.
At the stroke of midnight, there will be a "leap second" decreed by the International Earth Rotation and Reference Systems Service to allow astronomical time to catch up with atomic clocks that have called the hour since 1967.