The Prince of Wales has formally acknowledged “the appalling atrocity of slavery” in the Caribbean, saying “it forever stains our history” at an event to mark Barbados becoming a republic.

Prince Charles was invited to speak at the transition ceremony formalising the Caribbean island’s decision to remove the Queen as its head of state.

Speaking in front of a crowd in National Heroes Square in Bridgetown, once known as Trafalgar Square, he said: “From the darkest days of our past, and the appalling atrocity of slavery, which forever stains our histories, the people of this island forged their path with extraordinary fortitude.

“Emancipation, self-government and independence were your way-points. Freedom, justice and self-determination have been your guides.”

A 21-gun salute was fired just after midnight when the nation officially became a republic, marking a new chapter in the nation’s history.

The prince, who described how “the creation of this republic offers a new beginning”, watched as the Queen’s standard was lowered for the final time.

He described how he felt “deeply touched” to be invited to the event, held on the nation’s 55th anniversary of independence from Britain, and spoke of his great personal respect for the people of Barbados.

More on Barbados

He added: “Tonight you write the next chapter of your nation’s story, adding to the treasury of past achievement, collective enterprise and personal courage which already fill its pages.

“The creation of this Republic offers a new beginning, but it also marks a point on a continuum – a milestone on the long road you have not only travelled but which you have built.”

In a message to the people of the Caribbean island, the Queen sent her “good wishes for your happiness, peace and prosperity in the future” and emphasised the importance of the “continuation of the friendship” with the UK as she ceased to be their monarch.

Barbados’s decision to remove the Queen as head of state will be watched closely by other members of the Commonwealth, especially in the Caribbean region.

Prince Charles’ speech referenced the UK’s close relationship with Barbados and a continuing partnership between the two nations.

“As your constitutional status changes, it was important to me that I should join you to reaffirm those things which do not change,” Prince Charles said.

“For example, the close and trusted partnership between Barbados and the United Kingdom as vital members of the Commonwealth; our common determination to defend the values we both cherish and to pursue the goals we share; and the myriad connections between the people of our countries – through which flow admiration and affection, co-operation and opportunity – strengthening and enriching us all.”

After a dazzling display of Barbadian dance and music, Sandra Mason was sworn in as Barbados’s first-ever president.

Prime Minister Mia Mottley, the leader of Barbados’ republican movement, helped lead the ceremony.

Barbadian singer Rihanna also attended the event and was declared a national hero.

“May you continue to shine like a diamond and bring honour to your nation by your works, by your actions,” Ms Mottley told Rihanna, a reference to her 2012 chart-topping single Diamonds.

The transition ceremony was watched in-person by a large crowd, and broadcast online and on screens across the island.