SAN FRANCISCO - The Olympic torch was rerouted away from thousands of demonstrators and spectators who crowded the city's waterfront Wednesday to witness the flame's symbolic journey to the Beijing Games.

The planned closing ceremony at the San Francisco Bay waterfront was cancelled and another one was planned at San Francisco International Airport. Massive crowds had gathered at the waterfront to support or protest the flame.

The last-minute changes were made amid security concerns following chaotic protests over the torch in Paris and London.

Mayor Gavin Newsom told The Associated Press that the well choreographed fake-out was prompted by the size and behaviour of the crowds amassing outside AT&T Park, site of the relay's opening ceremony.

There was "a disproportionate concentration of people in and around the start of the relay," he said in a phone interview, while travelling in a caravan that accompanied the torch.

Less than an hour before the relay began, officials cut the original 10-kilometre route nearly in half.

At the opening ceremony, the first torchbearer took the flame from a lantern brought to the stage and held it aloft before running into a warehouse. A motorcycle escort departed, but the torchbearer was nowhere in sight.

Officials drove the Olympic torch about 1.5 kilometres inland and handed it off to two runners away from protesters and media, and they began jogging toward the Golden Gate Bridge - in the opposite direction of the crowds awaiting its passing.

Further confusion followed, with the torch convoy apparently stopped near the bridge before heading southward to the airport, where a closing ceremony on the tarmac was planned.

As the flame travelled toward the airport, news slowly dribbled through the crowds of more than 10,000 spectators and protesters gathered at the waterfront that the torch would not be headed there.

Spectator Dave Dummer said he was disappointed.

"That upsets me," Dummer said. "My back hurts from standing around on this lumpy sidewalk. ... This was a once-in-a-lifetime opportunity and other people messed it up by protesting."

There were signs of tension even before the torch relay began.

Pro-Tibet and pro-China groups were given side-by-side permits to demonstrate, and representatives from both sides spilled from their sanctioned sites across a major street and shouted at each other nose to nose, with no visible police presence to separate them.

At least one torchbearer decided to show her support for Tibetan independence during her moment in the spotlight. After being passed the Olympic flame, Majora Carter pulled out a small Tibetan flag that she had hidden in her shirt sleeve.

"The Chinese security and cops were on me like white on rice, it was no joke," said Carter, 41, who runs a nonprofit organization in New York. "They pulled me out of the race, and then San Francisco police officers pushed me back into the crowd on the side of the street."

Farther along the planned route, about 200 Chinese college students mobbed a car carrying two people waving Tibetan flags in front of the city's Pier 39 tourist destination. The students, who arrived by bus from the University of California, Davis, banged drums and chanted "Go Olympics" in Chinese.

"I'm proud to be Chinese and I'm outraged because there are so many people who are so ignorant they don't know Tibet is part of China," Yi Che said. "It was and is and will forever be part of China."

The torch's 137,000-kilometre, 20-country global journey is the longest in Olympic history, and is meant to build excitement for the Beijing Games. But it has also been targeted by activists angered over China's human rights record.

Hundreds of pro-China and pro-Tibet demonstrators blew whistles and waved flags as they faced off near the site of the relay's opening ceremony. Police struggled to keep the groups apart. At least one protester was detained, and officers blocked public access to bridge leading to the ceremony site across McCovey Cove from the ballpark.

One of the runners who planned to carry the torch dropped out earlier this week because of safety concerns, officials said. The torchbearers competed not only with people protesting China's grip on Tibet, but its support for the governments of Myanmar and Sudan.

Peter Ueberroth, chairman of the U.S. Olympic Committee, said the United States had struck the right balance between preserving freedom of speech for protesters, providing an exhilarating experience for the torchbearers, and preventing a repeat of the chaotic demonstrations that accompanied the torch in London and Paris.

"As close as anybody can do in a free society, so far its looking very good," Ueberroth said. "Virtually anybody and everybody is being heard."

The Olympic flame began its worldwide trek from Ancient Olympia in Greece to Beijing on March 24, and was the focus of protests right from the start.

Although torchbearers in other cities have complained of aggressive behaviour by paramilitary police in blue track suits sent by Beijing to guard the Olympic flame, there was no evidence of problems in California.

San Francisco was chosen to host the relay in part because of its large Chinese-American population.

IOC president Jacques Rogge met with Chinese Premier Wen Jiabao on Wednesday to discuss preparations for the games, and "a range of games topics were discussed," the IOC said.

Rogge is to give more details at a news conference Friday, when the IOC's executive board is to discuss Friday whether to end the remaining international legs of the relay after San Francisco because of widespread protest.

The torch is scheduled to travel to Buenos Aires, Argentina, and then to a dozen other countries before arriving in China on May 4. The Olympics begin Aug. 8.