Donald Trump took power as the 45th president of the United States on Friday and pledged to end what he called an "American carnage" of rusted factories and crime in an inaugural address that was a populist and nationalist rallying cry.
Striking a defiant tone, Trump said the American middle class has been devastated by the outsourcing of jobs abroad.
"From this moment on, it's going to be America First," the Republican told thousands of people gathered on the grounds of the National Mall as he took from Democrat Barack Obama.
With Obama and three other former presidents sitting nearby, Trump accused previous U.S. administrations of enriching Washington at the expense of struggling American families.
Underscoring the deep divisions in the country, protests against Trump turned ugly in downtown Washington. Black-clad activists smashed store windows, blocked traffic and fought with police in riot gear who responded with tear gas and stun grenades. CNN reported that 90 people had been arrested.
Aerial pictures of the crowds of Trump supporters on the Mall showed a much smaller turnout at midday on Friday than that in comparable photos from Obama's first inauguration in 2009. Estimates of Friday's crowd size were not immediately available from police.
The inaugural address was vintage Trump, with plenty of material gleaned from dozens of campaign rallies he staged last year on the road to victory on Nov. 8 over Democrat Hillary Clinton, who attended the ceremony with her husband, former President Bill Clinton.
Trump said the United States has enriched foreign industry at the expense of American companies, subsidized the armies of other countries while letting the U.S. military become depleted, and spent trillions abroad while allowing U.S. infrastructure to crumble.
"The wealth of our middle class has been ripped from their homes and then redistributed across the entire world," he said.
Trump accused the Washington establishment of protecting itself but abandoning regular citizens who have suffered from poverty and crime.
"This American carnage stops right here and stops right now," he said. "Every decision on trade, on taxes, on immigration, on foreign affairs, will be made to benefit American workers and American families," he said.
Trump, 70, takes over a country divided after a savage election campaign.
The dark vision of America he often paints is belied by statistics showing low levels of unemployment and crime nationally, although Trump won many votes in parts of the nation where manufacturing industry has been badly hit.
A wealthy New York businessman and former reality TV star who has never held public office, Trump will set the country on a new, uncertain path at home and abroad.
Trump's election was greeted with concern by many countries around the world, in part because of the potential for an isolationist foreign policy.
In an interview after Trump was sworn in, German Vice Chancellor Sigmar Gabriel said, "What we heard today were high nationalistic tones."
"I think we have to prepare for a rough ride," he told public broadcaster ZDF, adding Europe should stand together to defend its interests.
Mexican President Enrique Pena Nieto congratulated Trump on his inauguration, but cautioned that the sovereignty, national interest and protection of Mexicans would be paramount.
Mexicans have been angered by Trump's pledge to build a wall along the southern U.S. border to keep illegal immigrants out, and to make Mexico pay for it. Trump has also frequently criticized U.S. companies who have manufacturing operations in Mexico.
On financial markets, the dollar was down but U.S. stock indexes pared their gains in the last day of a choppy trading week, after Trump's inaugural speech prompted investor concern about protectionist trade policies.
Pope Francis urged Trump to be guided by ethical values, saying he must take care of the poor and the outcast.
In Moscow, Russians hoping Trump will usher in a new era of detente celebrated his inauguration. Russian nationalists held an all-night party at what used to be the main Soviet-era post office in Moscow. East of there, in the city of Zlatoust, craftsmen released a limited series of silver and gold commemorative coins, engraved with "In Trump We Trust."
Trump signalled the possibility of a more aggressive approach to Islamic State militants.
"We will reinforce old alliances and form new ones, and unite the civilized world against radical Islamic terrorism, which we will eradicate completely from the face of the earth," he said.
After repeating the 35-word oath of office, Trump stretched his arms wide and hugged his wife, Melania, and other members of his family. Ceremonial cannon blasts fired.
The transition from a Democratic president to a Republican took place before a crowd of former presidents and dignitaries.
After a congressional lunch in the domed U.S. Capitol, Trump and his wife, Melania, boarded a limousine to lead an inaugural parade to the White House. Obama headed to a vacation in Palm Springs, California after the ceremony.
Trump takes office with work to do to improve his image.
An ABC News/Washington Post poll this week found only 40 percent of Americans viewed him favourably, the lowest rating for an incoming president since Democrat Carter in 1977, and the same percentage approved of how he has handled the transition.
Trump's ascension to the White House, while welcomed by Republicans tired of Obama's eight years in office, raises a host of questions for the United States.
Trump campaigned on a pledge to take the country on a more isolationist, protectionist path and has vowed to impose a 35 percent tariff on imports from U.S. companies that went abroad.
More than 60 Democratic lawmakers stayed away from the proceedings to protest Trump.
Many demonstrators are to participate in a "Women's March on Washington" on Saturday. Protests are also planned in other cities in the United States and abroad.
Trump's to-do list has given Republicans hope that, since they also control the U.S. Congress, they can quickly repeal and replace Obama's signature healthcare law, approve sweeping tax reform and roll back many federal regulations they say are stifling the U.S. economy.
"He's going to inject a shock to the system here almost immediately," Trump senior adviser Kellyanne Conway told Fox News.
Democrats, in search of firm political footing after the unexpected defeat of Clinton, are planning to fight him at every turn. They deeply oppose Trump's anti-immigrant rhetoric from the campaign trail.
Trump's critics have been emboldened to attack his legitimacy because his win came in the Electoral College, which gives smaller states more clout in the outcome. He lost the popular vote to Clinton by about 2.9 million.
Trump's critics also point to the conclusion of U.S. intelligence agencies that Russia used hacking and other methods during the campaign to try to tilt the election in the Republican's favour. Trump has acknowledged the finding - denied by Moscow - that Russia was behind the hacking but said it did not affect the outcome of the election.