China said thousands of American sailors on board a flotilla of U.S. warships could spend Thanksgiving in Hong Kong as planned, but Thursday's message came hours after the ships had already left after earlier being refused entry to the city's port.

The USS Kitty Hawk aircraft carrier and several support vessels, including a nuclear submarine, were scheduled to dock in Hong Kong on Wednesday for a four-day visit. Hundreds of sailors' families had flown into the city to spend the holiday with their loved ones, while dozens of Americans living in Hong Kong had prepared turkey dinners for those on their own.

But the group was refused entry, Lt. Cmdr. Amy Derrick-Frost told The Associated Press by telephone from the U.S. Navy's Pacific Command headquarters in Hawaii, adding that no reason was given. She said the ships left Thursday for their home ports.

Hours later, Chinese Foreign Ministry spokesman Liu Jianchao said Beijing was allowing the Kitty Hawk and the other ships in its strike group to enter Hong Kong on humanitarian grounds.

"We have decided to allow the Kitty Hawk strike group to stay in Hong Kong during Thanksgiving, and it is a decision out of humanitarian consideration only," Liu told reporters at a regular media briefing in Beijing later Thursday. "China has informed the U.S. of this."

Officials at the U.S. Navy's Pacific Command headquarters in Hawaii were not immediately available for comment, but it was unlikely the ships would be able to return to Hong Kong.

It was not immediately clear why the vessels were barred Wednesday. Port officials said they had not been notified of the previously scheduled visit.

Asked repeatedly about Beijing's apparent reversal, China's foreign ministry spokesman Liu declined to comment.

The incident has added an unusual twist to China-U.S. relations, strained in recent months by disputes over trade and Iran's nuclear program.

In the past, China has banned all U.S. ships from the former British colony during times of tense relations. But current relations are not too bad, said David Zweig, a professor of China relations at the Hong Kong University of Science and Technology said.

"This is a surprise," Zweig said. "I haven't heard of ships being turned away like this before. I'm also disappointed and saddened for the families who have flown here expecting to see their relatives and are not now going to have their reunions."

Hong Kong has long been a favored port of call for the U.S. military but Beijing's approval has been required since July 1, 1997, when Britain handed this former colony back to China.

China banned U.S. ships entering Hong Kong waters in 1999 when NATO planes bombed the Chinese embassy in Belgrade during the Kosovo crisis and refused port calls for several months after a U.S. spy plane collided with a Chinese fighter jet in April, 2001.

The 46-year-old USS Kitty Hawk, which is based in the Japanese port city of Yokosuka, is the only U.S. aircraft carrier permanently deployed abroad.

The diesel-powered ship will be decommissioned next year and replaced by the nuclear-powered USS George Washington.

Relations between China and the United States have improved in recent years, but the two powers are at odds over how to resolve Iran's failure to halt enrichment of uranium and the growing trade deficit in the U.S.