Thousands of people spontaneously break into the Danish national anthem outside Christianborg Palace after Prime Minister Mette Frederiksen proclaims the new king.
Copenhagen's chief police inspector said there was no indication that anyone helped the gunman, identified as a 22-year-old Dane.
Danish voters are being asked to choose whether to abandon the country's decision three decades ago to opt out of the bloc's common defense policy.