A long-fermenting controversy, marked by spirited debate from Virginia to California, culminated yesterday in a federal ruling permitting vintners from three states to designate their wine bottles with "Shenandoah Valley" labels.

Wine produced in a 12-county region of Virginia and West Virginia may carry the "Shenandoah Valley" appellation, according to the ruling by the Bureau of Alcohol, Tobacco and Firearms.

Wine from California's Shenandoah Valley -- a region centered chiefly in Amador County near Sacramento -- must be bottled under a slightly more explicit label, the federal agency said. The West Coast wine must be marked "Shenandoah Valley, California."

The announcement tickled California wine producers and politicians who had feared their state might lose its rights to the Shenandoah label under new federal regulations. But it brought far more robust responses in Virginia, ranging from delight to disappointment and denunciation.

"I have nothing against the wine producers of Amador County, Calif., but I continue to object strongly to their effort to appropriate for their own commercial use a name which has national recognition as that of a Virginia area," said Rep. J. Kenneth Robinson (R-Va.), who represents much of the state's Shenandoah Valley wine-growing region. He complained that California's Shenandoah is a "miniscule valley" that has drawn "scant notice through the years, even from map makers."

An aide said Robinson would likely ask Treasury Secretary Donald T. Regan to overturn the bureau's ruling and reserve the "Shenandoah Valley" label exclusively for Virginia wines. Robinson may also propose legislation to deny the "Shenandoah Valley" mark to California vintages, the aide said.

The federal ruling, set to take effect Jan. 27, stems from an effort by the Bureau of Alcohol, Tobacco and Firearms to impose stricter regulations on wine labeling to benefit consumers.

"The use of the name 'Shenandoah Valley, California' allows consumers to readily identify where grapes used to make that wine are grown," the bureau said in its announcement yesterday. "The name 'Shenandoah Valley' for the Virginia and West Virginia viticultural area is well known and does not require adding the name of the two states."

Some Virginia officials detected in that reasoning a sour whiff of compromise. "It sort of reminded me of the King Solomon episode in the Bible," said Archie Smith Jr., chairman of the Virginia Wineries Association. "He said we'll just split the baby down the middle."

Federal wine regulators rejected such assertions. "This is not a compromise, as I see it. It is merely to avoid consumer confusion," said James A. Hunt, a research and regulation coordinator for the bureau who helped prepare the ruling.

The wine battle has aged since 1981 when federal proceedings, including public hearings in Virginia and California, were initiated. California, which has a major wine industry, firmly contested claims from Virginia, where commercial wine businesses only recently started expanding.

"We were making wine in the Shenandoah Valley of California long before they were making it in Virginia," an aide to Sen. Alan Cranston (D-Calif.) said yesterday. "We feel we had it first."

The federal ruling drew praise from the California Wine Institute and from Rep. Norman D. Shumway (R-Calif.), who represents the state's Shenandoah area. Even among some Virginia wine makers, there were some toasts. "We feel it's a victory," said Jim Randel, owner of Shenandoah Vineyards, which in 1979 became the first major wine producer in Virginia's Shenandoah Valley.