Officials from the Scottish Office, Foreign Office, Catholic Church and Church of Scotland were involved in anxious negotiations over the “delicate question” of if, and where, the two should meet in the run-up to the Pope’s visit in 1982.

According to government papers released yesterday by the National Archives of Scotland, it proved so difficult that at one point, it looked as if they might not meet.

The documents are made public as the new Pope, Benedict XVI prepares to visit Scotland next year.

In February 1982, Sir William Fraser, a senior Scottish Office official, wrote to the Foreign and Commonwealth Office about a lunch he had with four senior Church of Scotland figures, including the Principle Clerk of the General Assembly.

He writes: “I was much concerned at the prospect that public acrimony about the possible failure of the Moderator and the Pope to meet during the visit could exacerbate religious tensions, particularly in the west of Scotland.”

A plan devised between senior Catholic and Church of Scotland figures – for the Pope to make a brief visit to the Charlotte Square residence of the Moderator, Professor John McIntyre – came to nothing because, says Sir William, “the arrangement was overruled by the authorities in Rome who are reported to have said the Pope does not visit anyone”.

An alternative suggestion put forward by the Catholic Cardinal Gordon Gray – that the Moderator should call on the Pope at the cardinal’s residence – was dismissed by the four Church of Scotland representatives, who predicted that if the Church agreed to that scenario, “the matter would be raised as an emergency issue on the first day of the General Assembly with the virtual certainty that the Moderator would be requested or instructed not to do so”. Sir William adds: “I said I thought that would be deplorable for the Assembly and for Scotland.”

He continues: “It appeared to be the unanimous view of all four that unless arrangements were made for the Moderator to greet the Pope, however briefly and formally, on the Moderator’s ground, there will be no meeting.”

The planning for the visit went on against a background of opposition from some sections of Protestant opinion.

There was widespread concern about sectarian conflict, shared by the Scottish Secretary himself, George Younger. In a letter to the Foreign Secretary Lord Carrington, Younger predicts that “animosity between Protestants and Catholics” particularly in the west of Scotland, would increase if the two failed to meet.

Uncertainty about the meeting continued until days beforehand, but the Pope met the Moderator briefly in the courtyard outside New College on the Mound in Edinburgh.

The Pope addressed 300,000 people in Bellahouston Park in Glasgow during the trip.

The correspondence is among 11,000 documents being released between now and next May.

Such files were held for 30 years, but in June, the Scottish Government announced the period of retention would be reduced to 15 years. Bruce Crawford, parliamentary business minister, opening an exhibition at the National Archives on changing government attitudes to secrecy, said: “We are now moving from a period of need to know to a period of right to know.”

Other documents revealed that Scottish ministers were advised to back a recommendation to pour millions into a project privately acknowledged to be a “fiasco”. The DeLorean car, later made famous in the Back to the Future films, was produced in a factory in Northern Ireland. By February 1981, it had received £67m of state aid and the Northern Ireland secretary was seeking a further £10m. Scottish officials described the plant as “a straightforward sink for public funds”. But anticipating that ministers might have to request funds for Scottish car plants in the near future, they recommended supporting the Northern Ireland secretary.