Pope John Paul II took leave of Spain today by embracing the carved image of St. James the Apostle in the Hispanic abrazo that is the traditional gesture of reverence used by pilgrims down the ages when departing from the sacred shrine of Santiago de Compostela.

The pontiff's farewell at Santiago cathedral was symbolic of the theme of national reconciliation that has infused his 10-day, 16-city tour of Spain at a time of political uncertainty and tension in the country.

About 18 million people -- nearly one of every two Spaniards -- saw the pope in person, according to the calculation of a Spanish television commentator, an estimate that is not considered overly exaggerated. Spanish bishops readily acknowledge that the response to John Paul has far exceeded their hopes for the papal visit.

By coincidence, the visit, which was postponed from its original date last year by the assassination attempt on the pope, took place in the immediate aftermath of the landslide electoral victory of the Socialist Party.

John Paul's presence in Spain has served to deflect interest from the complexities of what is a momentous political transition. But more important, the visit appears to have brought together Spain's two traditionally antagonistic and intolerant blocs -- one Catholic and reactionary and the other anticlerical and progressive.

The tone of reconciliation was set at the start of the visit when King Juan Carlos introduced the pope to Socialist prime minister-elect Felipe Gonzalez at a glittering reception in the royal palace. Gonzalez will form Spain's first left-wing administration since the Spanish Civil War when he formally takes office next month.

A lapsed Catholic, the young leader greeted the pontiff with clear respect, and the two men's handshake was a front-page picture in the national press.

For Spaniards the image of Gonzalez and the pope appeared to remove lingering doubts that the Socialists in power might initiate a drive against the church in the manner of the republic in the 1930s when the leftist leaders proclaimed that "Spain has ceased to be Catholic."

The palace greeting was a signal as well for Spain's hard-line right that views the uprising by Gen. Francisco Franco against the republic and the ensuing civil war as a Christian crusade against atheism. Beyond the protocol handshake, the pope praised the nation's democratic process, thus implicitly endorsing the Spanish voters' decision for socialism and change.

The fundamental point that times have changed was made in a televised debate on the papal visit by Spanish sociologist Salvador Giner, who argued that the left had dropped its anticlericalism in the same way that the Spanish church had ceased to be a prop to the right. In the latter years of Francoism, the church became increasingly critical of the dictatorship and hostile to its patronage.

The pope went further than anticipated in his efforts to put the record of the church straight. In a meeting at Madrid University with academics and other intellectuals he publicly recognized the "errors and excesses" of the Spanish Inquisition. It was another nail in the coffin for the black legend of Catholicism in Spain.

In the pope's approximately 50 addresses delivered throughout the country, he blended a message of conservative theology and advanced teaching on social questions. If church traditionalists were cheered by the pope's uncompromising stand on abortion, birth control, divorce and priestly celibacy, others stressed his defense of human rights, individual freedoms and human dignity.

At a huge youth rally held in Madrid's main soccer stadium, the pope spoke out against drugs, alcohol, premarital sex and the rejection of traditional values. The 140,000 young people -- jumping up and down, singing and cheering -- loved it.

The response throughout the trip seemed to undermine the stock view of Spain as a society moving toward a post-Christian, secular consciousness -- a view reinforced as much by the electoral results as by a report by the Spanish bishops on rapidly falling church attendance, drastic drops in religious vocations and what the bishops called "a devaluation in the awareness of sin."

In contrast, the pope spent 10 days digging up and displaying Spain's deep religious roots. The visit was a kaleidoscope of religious pageants, each profoundly significant and essentially Spanish, linked to the nation's tradition, culture and history.

At the shrine of Guadalupe, high in the hills of the western region of Extremadura, the pope worshiped the local Black Virgin once venerated by the conquistadors, who extended her veneration to Mexico. At the medieval monastery of Montserrat, near Barcelona, John Paul prayed before another Black Virgin that has for centuries been a symbol of the nationhood of Catalonia.

Both devotions invited comparisons with the Virgin of Czestochowa in the pope's native Poland.

In Seville, the pope was greeted at the airport by joyous flamenco dancers. In the religious service that followed, a dozen young boys in 16th-century costumes danced a stately minuet dating from that century that is a liturgical anomaly and is performed only in the Seville cathedral on Easter Sunday.

In Zaragoza, capital of the region of Aragon, there is a devoted following for the local Virgin of the Pillar and many girls are accordingly christened Pilar. For the pope, the girls danced and sang the vigorous jota, which consists mostly of athletic leaps and sustained high notes.

In the Basque country the church services were accompanied by the haunting, reedy sound of the local flute, known among the Basques as the txistu.

In the middle of an exhausting schedule that left him visibly haggard at the end of each day, the pope paid private homage to two Spanish saints -- Teresa of Avila and her contemporary and friend John of the Cross -- to whom he referred as "the spiritual teachers of my inner life."

The lyrical otherworldliness of St. John of the Cross was the subject of the pope's doctoral thesis, and the practical, reforming zeal of St. Teresa, who had her own intense brand of mysticism, was strongly appealing to John Paul, who termed her "an extraordinary woman" and an example to all.

Other Spanish saints, notably St. Ignatius of Loyola, founder of the Jesuits and St. Francis Xavier, the Jesuits' most famous missionary, received their special tributes as the pope underscored repeatedly the singular contribution that Spain had made to the Roman Catholic Church.

Santiago de Compostela was the appropriate place from which to leave Spain today. Together with Rome and Jerusalem, the magnificently rich shrine was a focal point of medieval pilgrimages and continues to attract travelers, who traditionally walk the "way of St. James" across northern Spain from the Pyrenees.

The traditional embrace of the statue in the cathedral is seen as sealing a pact both with the Apostle James and with the nation of which he is patron saint.graphics /photo: UPI Pope John Paul II, ending his tour of Spain, blesses the crowd at Santiago de Compostela during the final mass of his visit which took him to nearly all corners of the country.