The raising of the UAE flag on December 2, 1971, to a 21-cannon salute, was the culmination of years of effort.
A day of chaos and jubilation
The sense of chaotic excitement on the day the UAE was born in 1971 led to such a clamour in the room where the UK and the newly formed nation signed their Treaty of Friendship that after the ceremony officials had to escape through a window.
The leaders of the six emirates - Ras Al Khaimah joined a couple of months later - gathered at Sheikh Rashid bin Saeed Al Maktoum's majlis in Jumeirah on the clear, crisp morning of December 2, 1971 to sign the country into being. Its provisional constitution was brought into force and the Supreme Council retired for a meeting, electing Sheikh Zayed as their first President.
At noon British officials, headed by Sir Geoffrey Arthur, the British Resident in the Gulf, were summoned to Jumeirah to sign a treaty between the two nations, in a small semicircular room of the building on Dubai Creek now known as Union House.
In a cable home the following day Sir Geoffrey, in typically politically incorrect parlance of the day, describes the spectacle that greeted them as "a scene of confusion remarkable even by Arab standards".
"Pressmen and photographers were standing on the table and it was little short of a miracle that nobody was injured and that the documents were retrieved intact," he continued.
Sir Geoffrey sat to Sheikh Zayed's right, while on his left sat Sheikh Rashid and the rulers of Sharjah, Ajman, Umm Al Qaiwain and Fujairah.
Julian Walker, the Political Agent in Dubai, is the only surviving member of the British delegation that day.
"It was jubilation and chaos," he recounts. "We managed to sign our new agreements between Britain and the Union but we couldn't get out of the villa because of the number of journalists and others cramming the doors.
"Along with the UAE rulers, we literally had to climb out of the window on to the beach side of the villa in order to see the raising of the flag."
That flag-raising, to a 21-cannon salute, was the culmination of years of effort.
"Zayed had started work on the union with Rashid three or four years before, and you could see that they were obviously pleased that they'd achieved a union.
"I was just relieved that we'd managed to get it together. I'd been so busy myself that it was only after we'd finished that I was able to inform the Foreign Office that there was to be a union of six," Mr Walker continued.
The treaty declared that relations between the two nations would "be governed by a spirit of close friendship" and the countries should "consult together in matters of mutual concern in time of need" and "settle all their disputes by peaceful means". Bahrain and Qatar, who had opted for independence, had already signed similar treaties ahead of the British withdrawal from the Gulf at the end of the year.
After the signing, Sheikh Zayed gave a short speech and Sir Geoffrey replied "in carefully composed classical Arabic". The diplomat later recalled that his speech was "fortunately lost to posterity when one of the throng of journalists inadvertently stamped or sat on the recording device".
There were inevitably uncertainties and concerns, with one of the most foremost being Iran's occupation of three islands.
On November 30, 1971, as British forces withdrew, Iran moved to occupy the Sharjah-ruled island of Abu Musa under an agreement that would allow troops in limited areas in return for a yearly payment.
The status of the Ras Al Khaimah-ruled Greater and Lesser Tunbs was one of the sticking points that kept the emirate from joining the union immediately.
A diplomatic cable from Sir Geoffrey describing events the next day highlights the concerns. He was charged with meeting the rulers of the six emirates on December 1 to "exchange notes" that cancelled British protection and effectively made the emirates independent.
While he describes his meeting with Sheikh Zayed as "a very friendly and dignified occasion", in Dubai the meeting "got mixed up with the drafting of a proclamation forbidding unlicensed demonstrations [several of which were going on in Dubai at the time]".
There was anger across the emirates over the Iranian occupation, but particularly in the north, with street demonstrations and scuffles. On December 2, Al Maktoum bridge had to be raised to stop demonstrators crossing the bridge to Jumeirah where the union was being signed.
When Sir Geoffrey arrived in Sharjah, the majlis was "packed", according to the cable.
"He [Sheikh Khalid, the ruler of Sharjah] asked me questions about Abu Musa and the Tunbs in a loud voice and specifically requested me to answer so that all present could hear," Sir Geoffrey explains.
The British diplomats' visit to Fujairah underlines just how much uncertainty there was in the lead-up to union. Sheikh Mohammed bin Hamad Al Sharqi "said that he did not want to be independent at all. He liked the British protection, and he did not see why he should exchange notes bringing [it] to an end", Sir Geoffrey wrote.
However, after an explanation that the British military camp at Masafi would be handed to the emirate rather than the union, "[Sheikh Mohammed] provided a variety of fruit, recommended camel's milk for strength and potency, cracked esoteric jokes with Mr Walker, and finally signed the reply to my note on his knee".
In all, Sir Geoffrey concluded: "Quite a day."