The leader of the Scottish Conservatives has condemned as "a steaming pile of nonsense" the lowering of flags on public buildings as a mark of respect after the death of the Saudi king.

Downing Street and other Whitehall departments - along with Westminster Abbey and Buckingham Palace - were among prominent landmarks to put Union Flags at half mast after a request was sent out by the Department for Culture, Media and Sport (DCMS).

Officials said it was a matter of protocol and that the formal request had been made by the Palace.

But the move caused disquiet because of the human rights record of the country during King Abdullah's reign, with recent outrage focused on the public beheading of a woman and a sentence of 1,000 lashes meted out to the creator of an online blog.

Ruth Davidson said it was a "stupid act on its own and a stupid precedent to set".

She tweeted: "Flying flags at half mast on gov buildings for the death of Saudi king is a steaming pile of nonsense. That is all."

A notice issued on the DCMS website said: "It is with great regret that we learn of the death of the King Abdullah bin Abdulaziz, King of Saudi Arabia.

"It is requested that all flags be half-masted from 8am today until 8pm this evening.

"Any other UK national flags flown alongside the Union Flag when it is at half-mast should also be at half-mast. If a flag of a foreign nation is normally flown on the same stand as the Union Flag, it should be removed.

"Local authorities are not bound by this request but may wish to follow it for guidance. Devolved administrations are responsible for issuing instructions for the flying of the Union Flag on buildings in their estate and others as necessary."

The issue also split opinion between two of Ukip's key figures.

A spokesman for leader Nigel Farage said it showed "respect for an ally in the war against terror" and that the issue of human rights should be taken up with the new king.

But MP Douglas Carswell said officials had seriously blundered and showed "immoral" values far from those of the British public.

The decision drew criticism from many on social media, some of which was reposted by Mr Carswell.

Referring to the civil service as Sir Humphrey - the mandarin from television series Yes Minister - he said: "On the day that Sir Humphrey lowers the Union Jack in Whitehall to mark the passing of the Saudi monarch, I wonder how many public executions there are going to be in Saudi Arabia?

"Why are we doing this? I think Sir Humphrey has seriously blundered.

"Sir Humphrey's values need to be aligned more closely to people in this country rather than being quite so immoral. Saudi Arabia is a country that doesn't let women drive and publicly executes people."

Asked if Mr Farage was comfortable with the decision, his spokesman said: "Lowering a flag is an issue of diplomatic protocol, respect for an ally in the war on terror.

"We should forcefully take up the issue of human rights with the new not the dead king."

The mark of respect was not adopted north of the border.

A Scottish Government spokesman said: "We offer the people of Saudi Arabia our condolences following the passing of King Abdullah.

"Flags are not routinely flown at half-mast from Scottish Government buildings to mark the deaths of foreign heads of government or state."