She was a devout believer and found comfort in her personal faith.
Her way of life, conduct and her speeches were testimony to her religious belief and trust in God.
She was Defender of the Faith, a title originally conferred on Henry VIII in 1521 by Pope Leo X and which the king retained after he made himself supreme head of the new Anglican church.
The Queen’s position did not include the faiths of the millions of Muslims, Hindus or Jewish people or those of other faiths in multicultural Britain.
But her role as head of state and head of the Commonwealth was to respect and recognise different religions.
Her Christmas and Commonwealth broadcast speeches often addressed the theme of religious tolerance and royal ceremonial occasions were often attended by multi-faith leaders.
The new King once indicated in 1995 that he would rather see the role as Defender of “Faith”, rather than “the Faith” on his accession.
But Charles later suggested he would still be sworn in as Defender of the (Anglican) Faith, adding: “It always seems to me that while at the same time being Defender of the Faith you can also be protector of faiths.”
The Queen had many encounters with the head of the Roman Catholic church.
She met Pope John XXIII, Pope John Paul II, Pope Benedict XVI, who undertook the first official Papal visit by a Pope to Britain in 2010, and Pope Francis, and in 1951, as Princess Elizabeth, she met Pope Pius XII.
But as monarch, she greeted them in her role as head of state rather than as head of the Church of England.
At her coronation – a deeply Christian service – she promised to maintain the Church of England.
At her Accession Council shortly after she became Queen, she made an oath to preserve the Church of Scotland as has been custom for monarchs since the 16th century.
Despite her position, the Queen was not responsible for the church’s administration or religious matters.
The church’s decisions are made by its General Synod, which the Queen opened every five years.
On the advice of the prime minister, the Queen appointed archbishops, bishops and deans of the Church of England, who swore an oath of allegiance and paid homage to the monarch.
Church of England deacons and parish priests also swear an oath of allegiance to the sovereign.
In 2014 Nick Clegg, the then deputy prime minister, suggested that the church and state should be separated “in the long run” and “stand on their own two separate feet”.
But the prime minister at the time, David Cameron, spoke out against disestablishmentarianism and insisted the current arrangements worked well.
In her Golden Jubilee year, the Queen made history in Scunthorpe when she visited a British mosque for the first time.
A day later, in Leicester, she made her first visit to a British Sikh temple.
Throughout her life, her faith was a source of strength, and she attended church each Sunday.