A goodwill visit to San Francisco and the Sonoma Coast by a big, handsome Russian sailing ship was suddenly canceled Friday, the result of a complicated legal problem that involves both history and cultural treasures.

It was a baffling morning that left two boatloads of diplomats and members of the Russian and Polish communities sailing around on the bay waiting for a ship that never arrived.

The ship is the 360-foot-long sail training vessel Nadezhda, which was due at the San Francisco sea buoy, outside the Golden Gate, at 9 a.m. A pilot was ready to board the Nadezhda to guide it into the harbor, longshoremen were assigned to tie it up at Pier 27 on the city's waterfront, and nearly 100 people were aboard two boats ready to greet the ship.

But just after dawn, a message came from the Maritime State University in Russia. The Nadezhda wasn't coming. The captain got orders to avoid any U.S. port and head for Mexico.

Norton Lilly International, the ship's Bay Area agents, were told unspecified "political problems" - a phrase not heard from Russian vessels since the Cold War - was the reason for the change.

Big plans washed out

The switch was sudden. The Russian Consulate in San Francisco, as well as the local Russian and Polish communities, had laid out elaborate plans to entertain the ship's crew, and to organize a visit to Bodega Bay and Fort Ross on the Sonoma Coast, two areas that were colonized by the Russians nearly 200 years ago.

The change even took Russian Consul General Vladimir Vinokurov by surprise. He had been made aware of some diplomatic problems surrounding the visit, but thought they had been resolved.

"It's complicated," he said.

Vinokurov said the change in orders came as a result of what he called "a long problem" that involves lawsuits and a diplomatic dispute over the so-called Schneerson Library, a collection of more than 62,000 Jewish religious books and documents held by the Moscow State Library. The library was assembled by the Chabad-Lubavitch Hassidic movement over about 200 years.

Some of the material was seized by the Soviet government soon after the October revolution and another portion was captured by the Nazis during World War II and seized by the Soviet Union after the war. Lawyers for the Chabad organization, based in New York City, say that the Russians had shown no interest in the library and had kept it boxed up in the basements of museums.

In 1991, in the last years of the Soviet Union, a court in Moscow ordered the library turned over to the Chabad organization. But the Soviet Union collapsed and the new Russian authorities set aside the judgment. The Russian government now says it wants to preserve the library itself for the use of scholars and Russian Jews.

The Chabad organization felt it could not get a fair hearing in Russian courts and sued the Russian government in U.S. courts to acquire the library. Last year, a U.S. court ruled in the organization's favor and ordered Russian authorities to turn the library over.

The Russians refused. "We argue that this case is outside the jurisdiction of U.S. courts," Vinokurov said.

Cultural standoff

However, the Russian government is concerned and has advised Russian museums not to lend any artwork or other cultural artifacts to U.S. museums because they might be seized as part of the lawsuit.

The result has been a complex, if obscure, diplomatic standoff. Several American museums have been affected, including the Metropolitan Museum of Art in New York.

Apparently, Russian authorities also believed the Nadezhda - a cultural institution in its own right - might be affected as well. Vinokurov said he had been told that some unspecified "new information" led the Russian government officials to suspect the ship might be seized under a court order if it were to call at a U.S. port.

"So the captain decided not to come to San Francisco," Vinokurov said.

He acknowledged that decisions of this nature are not usually made by ship captains, but by their owners, probably the Russian Maritime State University in Vladivostok. Though Vinokurov did not say so, the school was probably following government orders.

No one to welcome

It all came as a complete surprise to people on board two sailing schooners that went out to meet the Nadezhda on Friday morning. Some were from the local Russian community, and some were of Polish descent, there to honor the ship, which was built in the famous Lenin shipyard in Gdansk, Poland, in 1961.

"We were all very disappointed," said Sarah Sweedler, executive director of the Fort Ross Interpretive Association, who was aboard a schooner waiting to greet the Russian ship.

After a three-day visit to San Francisco, the Nadezhda had planned to sail to Bodega Bay, anchor outside the harbor and ferry some crew members ashore. They would then be taken by bus to Fort Ross, an outpost established by Russians in 1812.

The Nadezhda was to be the second Russian sailing ship to visit San Francisco this year. This summer, the sail training ship Pallada called at San Francisco without incident.

It was not clear whether other Russian-flag ships might be affected when visiting U.S. ports.

When last heard from, the Nadezhda was 100 miles off the California coast, heading south. A planned visit to Honolulu later this month was also canceled.