The Queen has formally declared the 20th Commonwealth Games open at the end of a colourful ceremony at Celtic Park in Glasgow.

The head of the Commonwealth spoke of the "bonds that unite" the 71 nations and territories when she delivered her message which has travelled the world inside the Games baton.

There was a brief moment of embarrassment when the baton containing the Queen's message refused to open for Prince Imran of Malaysia, the president of the Commonwealth Games Federation, to release the manuscript. But Sir Chris Hoy, who had carried the baton to the prince, instinctively came to the rescue.

There were then loud cheers and applause as the Queen declared the competition open.

The message, which was kept secret until tonight, has circled the globed over the last nine months, since the Queen placed the paper inside the baton which then visited all 71 locations.

Reading the message, the Queen said: "At Buckingham Palace last October I placed this message into the specially-crafted baton and passed it to the first of many thousands of baton-bearers. Over the past 288 days the baton has visited all the nations and territories of the Commonwealth, crossing every continent in a journey of more than 100,000 miles.

"The baton relay represents a calling together of people from every part of the Commonwealth and serves as a reminder of our shared ideals and ambitions as a diverse, resourceful and cohesive family.

"And now, that baton has arrived here in Glasgow, a city renowned for its dynamic cultural and sporting achievements and for the warmth of its people, for this opening ceremony of the Friendly Games."

The Queen, in her role as head of the Commonwealth, sent her best wishes to the competing athletes when she addressed the opening ceremony at Glasgow's Celtic Park.

She said: "To you, the Commonwealth athletes, I send my good wishes for success in your endeavours. Your accomplishments over the coming days will encourage us all to strengthen the bonds that unite us. You remind us that young people, those under 25 years of age, make up half of our Commonwealth citizens; and it is to you that we entrust our values and our future.

"I offer my sincere thanks to the many organisations and volunteers who have worked diligently to bring these Games to fruition, and indeed to the spectators here in the stadium and to the millions watching on television. Together, you all play a part in strengthening our friendships in this modern and vibrant association of nations.

"It now gives me the greatest pleasure to declare the 20th Commonwealth Games open."

The ceremony featured a host of Scots stars including James McAvoy and Ewan McGregor and began with Scottish comedian Karen Dunbar welcoming the sporting nations to Scotland.

McAvoy, who asked viewers to donate money to Unicef during his appearance at the Opening Ceremony, said: "Glasgow, I'm proud to be one of your sons, you're amazing. Glasgow is the most generous city I've ever been in".

An audience of around 40,000 have gathered at Celtic Park to witness the arrival of the Queen's baton and mark the official start of the 11-day competition.

Ahead of the Opening Ceremony, Billy Connolly , who is attending the event, said: "I am a Glaswegian and I'm very, very proud of Glasgow.

"I'm looking forward to the Commonwealth Games, I've never known such a thing to come to Glasgow, it's so huge but I think Glasgow will respond well, they are great enthusiasts for sport, they're great enthusiasts for everything."

Dunbar, wearing a kilt, told the cheering crowd: "Welcome to Scotland."

In the opening act, Glasgow-born Dr Who actor John Barrowman and Dunbar, star of the comedy sketch show Chewin' The Fat, sang "Welcome to Scotland" and took viewers on a trip round Scotland with a colourful cast and props representing places and culture.

Dressed in a purple suit, Barrowman made his entrance from beneath a giant kilt and kissed a veil-wearing male "bride" at a mock Gretna Green before being carried along on a sea of "heather".

The Loch Ness monster, Glasgow's history of ship-building and the Forth Rail Bridge all featured in the act, which also celebrated the great Scottish inventions.

The fast-moving "Kingdom of the Scots" sequence featured the firing of the One O'Clock Gun at Edinburgh Castle, a giant haggis and Tunnock's famous teacakes.

A tyre - included as a tribute to pioneer John Boyd Dunlop - was transformed into Nessie and the Standing Stones of Callanish were represented by giant slabs of shortbread.

There was singing on top of whisky barrels and St Andrews was celebrated as the home of golf.

The cast gathered under the Forth Rail Bridge, which was supported by cans of Irn-Bru - known as Scotland's other national drink - and Barrowman finished the number standing on top of a replica of the iconic Finnieston Crane.

Dunbar sang: "It's a land of invention and culture that's true; But all that matters really; Is that Scotland's full of people just like you."

She said: "This is our home and you're all very welcome. Whoever you are, wherever you're watching, come on in and meet the people of Glasgow."

The Opening Ceremony show has received mixed reviews on social media.

Mike Hurst tweeted: "This is everything I feared the Olympic opening ceremony was going to be. #nearmiss #CommonwealthGames."

Vici Watkins tweeted: "I thought this was the Commonwealth Games opening ceremony. Why am I watching Eurovision?"

Liv Schorah tweeted: "I've seen school plays better than that opening ceremony."

Liam Houghton tweeted: "Danny Boyle is trending. That's all you need to know about the #Glasgow2014 Opening Ceremony."

However, others were delighted with the show.

Helen tweeted: "Dancing Tunnocks Teacakes! Best opening ceremony ever!"

Kenny Simpson tweeted: "I get why the opening ceremony is getting some hate, but I'm actually quite enjoying it tbh. #Glasgow2014."

Tim Key tweeted: "The one word to describe this opening ceremony so far is cringe! Yet I strangely like it. #Glasgow2014."

Speaking in an earlier video message on the stadium's 100-metre wide screen, Unicef ambassador Ewan McGregor told the crowd and an anticipated one billion television viewers: "I'm proud to say welcome to Scotland, welcome to Glasgow, welcome to the opening ceremony of the 2014 Commonwealth Games."

Glasgow 2014 organisers have teamed up with Unicef to ask viewers across the nations to donate to its Children of the Commonwealth Fund.

Rod Stewart performed Rhythm of My Heart prior to the Queen's arrival, with Susan Boyle singing Mull of Kintyre.

Ahead of her performance, Boyle said: "I was very gobsmacked to be asked to perform and I'm excited to be here."

I'm proud to be Scottish, especially on an occasion like this."

Dancers from Scottish Ballet also performed a routine to an acoustic version of The Proclaimers hit I'm Gonna Be (500 Miles).

Team India, as the host of the 2010 Games, were the first competing nation to enter the arena to cheers from spectators, with each squad being led in by a Scottie dogs.

Actor Ewan McGregor then introduced video footage from Bangladesh showing the work of Unicef to protect children affected by flooding there, and Indian cricketing star Sachin Tendulkar told viewers: "We have an opportunity to show the world what we can do when we act as one."

McGregor said: "Tonight at the end of the parade we're going to come together as one Commonwealth family to do something amazing - we're going to put children first.

"We will change the lives of millions of children across the Commonwealth."

Team Bangladesh entered the arena, followed by the six other Asian nations including Malaysia, who received a particularly loud cheer. The country's athletes all wore black armbands and flew their flag at half mast as a tribute to the victims of MH17.

Each parade was led by a Scots man or woman in tweeds and walking a Scottish terrier wearing a jacket bearing the name of the country.

A second Unicef video featured Spooks and Line Of Duty actress Keeley Hawes, reporting on the importance of vaccination programmes for children.

Athletes from Team Australia were welcomed followed by the rest of the Oceania region, including Norfolk Island.

During the parade, a team member from Tonga received a loud cheer when he held aloft a Celtic football shirt with a grin.

Athletes from all nations waved, danced and took photographs as they made their way around the arena.

African teams followed a video by Olympic cycling legend Sir Chris Hoy in Malawi, and Caribbean nations were introduced after a clip by actor and Radio 1 DJ Reggie Yates in Jamaica.

Singer and X Factor judge Nicole Scherzinger, meanwhile, welcomed the Americas in a video clip from Guyana.

Welsh former hurdler Colin Jackson teamed up with Sir Alex Ferguson for a video clip ahead of the entry of Europe teams.

England received a huge cheer as they entered the arena led by flag-bearer Nick Matthew, a multiple squash world champion, while rhythmic gymnast Francesca Jones performed the honour for Wales.

Team Scotland unsurprisingly got the biggest cheer of the night when they entered to the song Move Any Mountain by Aberdeen band the Shamen and a burst of blue and white coloured ticker tape.

The Scottish athletes were led by Judo star Euan Burton.