Tanks, missile launchers and chanting troops greeted President Xi Jinping in a potent display of Chinese military might Friday as part of his landmark visit to politically divided Hong Kong.
The show of force came hours after activists were released from police custody following their arrest over a protest.
Xi arrived in the city on Thursday to mark 20 years since Hong Kong was returned to China by Britain, with authorities desperate to stick to the script during anniversary celebrations.
A huge security operation has shut down large parts of the city, with thousands of police deployed to keep away demonstrators angry at Beijing's tightening grip on the freedoms of nearly eight million people.
Xi inspected troops at China's People's Liberation Army airfield in rural northern Hong Kong Friday morning, wearing a black Mao suit and riding an open-top camouflage jeep in the largest military parade since the 1997 handover.
As the jeep slowly drove past row upon row of air, naval and land personnel, Xi shouted "Hello comrades!" as the troops responded "Hello chairman!"
Armoured vehicles topped with missile launchers and military helicopters lined Xi's path along the airstrip for the eight-minute extravaganza.
Members of the public waved flags from packed stands and were given gift bags including a camouflage cap, water and snacks in the blazing heat.
Press were issued a notice ahead of the event barring them from bringing an eclectic list of items, including make-up, deodorant, plants, animals, opium and heroin.
There were fears that the PLA would crack down in Hong Kong when it was returned to China, particularly after the brutal crushing of student protests in Beijing's Tiananmen Square in 1989, but it has kept a very low profile.
Friday's parade was a rare display.
The PLA is responsible for defending the city and comprises only mainland troops, with Hong Kong residents unable to serve, but it is barred from interfering in local affairs.
A banner behind the troops read "Fully implementing 'one country, two systems', this great policy", referring to Hong Kong's semi-autonomous set-up.
As part of the handover deal, Hong Kong was guaranteed rights including freedom of speech and an independent judiciary for 50 years, but there are concerns those liberties are disappearing as Beijing becomes ever more assertive.
Xi's three-day visit is his first since becoming leader in 2013, and comes three years after huge pro-democracy rallies crippled Hong Kong.
Student protest leader Joshua Wong and young legislator Nathan Law were among those detained by police Wednesday night for "public nuisance" over a protest a stone's throw away from the hotels where Xi and his entourage are staying.
The 26 activists arrested were released from police custody in the early hours of Friday after threatening to go to the High Court to petition against their ongoing incarceration.
Police told AFP they had not been charged, but bailed to report back in September.
In public comments Thursday Xi pledged support to Hong Kong and praised the government for "dealing a blow" to an independence movement that has infuriated Beijing.
Calls for the city to break away from China grew out of the failure of the mass pro-democracy rallies in 2014 to win political reform.
Xi will attend a banquet at the harbourfront convention centre Friday night, followed by a variety show.