On 3 March 1986, BM Brownhill wrote to the prime minister, Margaret Thatcher, expressing disquiet over government plans to allow shops to open on Sundays. “I am a Christian and believe that Sunday is a day of rest,” Brownhill explained.

Brownhill (gender unknown) was not alone in this view.

MJ Wall argued that “the lifting of restrictions on Sunday trading is a further erosion of family life since more women who are married will be tempted to work on Sunday, just the day that they are needed to be with their families.”

And MS Hursey feared that “the rhythm of life for everybody, Christian and non-Christian, will also suffer adversely and irreparably if the day of quiet and rest is lost.”

A confidential internal briefing for Thatcher, drawn up by a No 10 policy adviser, Hartley Booth, which has just been published by the National Archives, reveals that Downing Street was deluged on a daily basis with a “foot high” pile of letters opposing Sunday trading during a tumultuous debate that was to lead to a revolution in leisure habits.

Booth, who was charged with sifting through the 32,543 letters on the subject sent to Downing Street, was himself opposed to Sunday opening, fretting that the government’s “inflexible” commitment to relax the law – a manifesto pledge – was damaging Thatcher’s political reputation.

“The message is you are putting your finger on a raw nerve by touching Sunday,” Booth wrote in his briefing in which he discussed the merits of a compromise solution that would avoid full-blown deregulation.

The memo is just one piece of correspondence in an extraordinary cache of documents that reveals how Conservative ministers squabbled for years over legislation allowing shops to open on Sunday, a move that helped shape the modern weekend by paving the way for wider reforms affecting Sundays, notably the relaxation of drinking hours, club licensing and the lifting of restrictions governing sporting events.

At the time, most politicians agreed that the law on Sunday trading was archaic. As a confidential Conservative research department briefing for the party’s MPs observed, the law was “widely defied and riddled with anomalies” which meant that, on Sundays, it was “legal to sell gin but not dried milk … leather jackets but only to motorcyclists … and a pornographic magazine but not the Bible.”

But the Thatcher government faced a conundrum. How could it overhaul the law while placating the vocal church lobby, much of it Tory-leaning? A powerful campaign against deregulation by the shopworkers’ union held similar sway over Labour, suggesting the legislation faced a tricky path through the Commons.

Confidential memos reveal that, to resolve the impasse, ministers discussed handing local authorities the responsibility for Sunday licensing laws. Another suggestion was to introduce deregulation for five years, a limited period that would not be renewed if it proved unpopular.

The Archbishop of Westminster Basil Hume, left, the Archbishop of Canterbury Dr Robert Runcie, centre, and the moderator of the Free Church Federal Council Dr Ronald English outside the Home Office in 1986, with a sackful of petitions signed by nearly 800,000 Christians to Keep Sunday Special. Photograph: PA

Neither proposal was popular with one particular politician, who the papers reveal was a key advocate for liberalisation. In a letter to the then Archbishop of York, the home secretary, Douglas Hurd, wrote: “It is certainly not for a home secretary to quote scripture to an archbishop, but the phrase about the Sabbath being made for man and not man for the Sabbath has been often in my mind in recent weeks.”

However, the Tories’ flagship shops bill presaging change was voted down, something that saw the shell-shocked Thatcher government abandon pub licensing law reform for fear that it would suffer a similar fate.

Unperturbed, in 1988 Hurd returned to the fray, pushing a green paper that outlined the “philosophical context” for deregulation so that “people should be free to choose how they spend their Sunday”.

The paper – which led to many of the reforms to Sunday licensing that came later – proposed removing restrictions on Sunday sporting events, allowing racing to take place and betting shops to open.

It also outlined plans for “relaxing the prohibition on dancing, promoting debate on further reform of alcohol licensing and deregulating Sunday licensing.”

Thatcher was unconvinced. Her political antennae sensed history would simply repeat itself. In one memo she scrawled: “I should leave this topic alone for the time being. It will open up the same divisions.”

The government, though, was being outmanoeuvred. DIY superstores such as B&Q were flouting the law and appealing to the European Court of Justice against the fines handed down by local authorities.

Hurd suggested using a private member’s bill, tacitly supported by the government, to bring in change. Again, Thatcher resisted, suggesting it was “the last thing we need at present”.

However, events were moving apace. By 1991 Thatcher had gone and the supermarket chains had taken to opening in the run-up to Christmas in defiance of the law, an event that prompted an alarmed Home Office to seek guidance from the attorney general, Sir Patrick Mayhew, who concluded that “no action should be taken”.

In the legal lacuna, one memo reveals how a desperate government, by now led by John Major, considered asking one of the larger supermarket chains not to open in the hope that “if they did so the others would fall in line”.

The genie was out of the bottle and the Major government had little choice but to embrace the measures that had so deeply conflicted its predecessor. The 1994 Sunday Trading Act allowed large shops in England and Wales to open for up to six hours on a Sunday. Things would never be the same again.