Denmark’s Queen Margrethe II has tested positive for Covid-19 after attending Queen Elizabeth's funeral in London, the royal palace said.

Queen Margrethe, 82, who has been on the throne for 50 years, cancelled her official duties after the Tuesday night test, according to a royal household statement.

Her eldest son, heir-to-the-throne Crown Prince Frederik, and his wife, Crown Princess Mary, would take Queen Margrethe’s place hosting a dinner with Danish government officials and members of parliament, the palace added.

Queen Margrethe previously tested positive for the virus in February.

At the time, the palace said she had received three doses of a Covid-19 vaccine.

READ MORE: Scottish composer was 'deeply honoured' to write anthem for Queen's funeral

Queen Margrethe was among the dignitaries who attended the Queen’s funeral at Westminster Abbey on Monday.

The Danish monarch’s half-century reign makes her Europe’s longest-serving sovereign following the death of the Queen, 96, who ruled for 70 years.

Out of respect for the late British monarch, Queen Margrethe had asked her court to adjust the September 10-11 programme for her own 50-year anniversary commemorations.

Among the events she cancelled at short notice was an appearance on the Amalienborg Palace balcony to greet well-wishers and a ride in a horse-drawn carriage through Copenhagen.

Queen Margrethe was proclaimed queen on January 15 1972, a day after her father, King Frederik IX, died following a short illness.