When the wearing of Solidarity union badges was banned last year under martial law, Poles donned pins bearing the likeness of the serene Black Madonna of Czestochowa, treasure of the Jasna Gora monastery whose 600th anniversary Pope John Paul II is observing with his pilgrimage to Poland.

The picture, honored as Poland's holiest icon, today stands for many of the same things that the memory of the Solidarity movement does--national resistance, independent thought and devotion to high ideals.

Its past stretches back into the mists of unwritten history. According to legend, it was painted by Saint Luke on wood from the kitchen table of Mary, mother of Jesus, and the frame is said to have been fashioned by Jesus himself. But scientific research in this century points to more mundane origins.

The most widely accepted theory has the icon being given as a gift by the Byzantine court in Constantinople to a Russian nobleman in the Middle Ages. He reportedly took the painting back to Russia, where a Polish prince, Ladislaus of Opole, claimed it as booty and brought it to Czestochowa as a present for Pauline monks at the monastery he founded on Jasna Gora hill in 1382.

The icon and monastery are associated with great moments in Poland's troubled history. In the mid-1600s Jasna Gora was the last piece of Polish territory to resist an invasion by Swedes, who never did succeed in breaching the cloister's stout walls. Poles called their failure a miracle, and ascribed it to the protective powers of the Black Madonna. On his last visit to the monastery in 1979, the pope declared: "On Jasna Gora, we have always been free."

Darkened by age, the picture shows a solemn madonna and child. Believed to have been modeled in content after a Byzantine portrait, but Western European in its tender, softly outlined forms following a 15th century restoration, the icon is emblematic of Polish culture--neither Western nor Eastern.

The picture's most distinguishing feature is a pair of slashes down Mary's right cheek. These are a reminder of the sacking of the monastery in 1430 by Hussite robbers who severely damaged the icon, and serve as a poignant symbol of Polish suffering.

Each year more than 6 million pilgrims visit the shrine. This creates a kind of paradox for the Pauline monks, whose rigorous order was originally sworn to a life of isolation and hard discipline, not the operation of a major tourist attraction.

"Religious activities can be quite hectic here," said Jerzy Tomzinski, a 65-year-old monk and former prior in the monastery. "Thirty years ago, all masses finished at 5 p.m. and pilgrims would come only on holidays. Now we have visitors day and night. We consider it a miracle we can manage. We're constantly adjusting."

The city of Czestochowa, a grim former textile center on the main highway from Warsaw to the Silesian mining region, has been slower to adjust. For many years Communist authorities ignored the shrine's significance and refused to fund facilities to handle the flow of pilgrims to Jasna Gora. A modern hotel finally was built about a decade ago, and another is planned here along with some more modest tourist housing.