Portuguese traders first settled in Macau in the 16th century. In 1557 Macau was rented to Portugal by the Chinese empire as a trading port. The Portuguese administered the city under Chinese authority and sovereignty until 1887, when Macau became a colony of the Portuguese empire. Sovereignty over Macau was transferred back to China on 20 December 1999.
The Sino-Portuguese Joint Declaration on the Question of Macau and the Macau Basic Law stipulate that Macau operate with a high degree of until at least 2049, fifty years after the transfer
After Portuguese permanent settlement in Macau, both Chinese and Portuguese merchants flocked to Macau, although the Portuguese were never numerous (numbering just 900 in 1583 and only 1,200 out of 26,000 in 1640). It quickly became an important node in the development of Portugal's trade along three major routes: Macau-Malacca-Goa-Lisbon, Guangzhou-Macau-Nagasaki and Macau-Manila-Mexico. The Guangzhou-Macau-Nagasaki route was particularly profitable because the Portuguese acted as middlemen, shipping Chinese silks to Japan and Japanese silver to China, pocketing huge markups in the process. This already lucrative trade became even more so when Chinese officials handed Macau's Portuguese traders a monopoly by banning direct trade with Japan in 1547, due to piracy by Chinese and Japanese nationals.
Macau's golden age coincided with the union of the Spanish and Portuguese crowns, between 1580 and 1640. King Philip II of Spain was encouraged to not harm the status quo, to allow trade to continue between Portuguese Macau and Spanish Manila, and to not interfere with Portuguese trade with China. In 1587, Philip promoted Macau from "Settlement or Port of the Name of God" to "City of the Name of God" (Cidade do Nome de Deus de Macau).
The alliance of Portugal with Spain meant that Portuguese colonies became targets for the Netherlands, which was embroiled at the time in a lengthy struggle for its independence from Spain, the Eighty Years' War. After the Dutch East India Company was founded in 1602, the Dutch unsuccessfully attacked Macau several times, culminating in a full scale invasion attempt in 1622, when 800 attackers were successfully repelled by 150 Macanese and Portuguese defenders. One of the first actions of Macau's first governor, who arrived the following year, was to strengthen the city's defences, which included the construction of the Guia Fortress.
As well as being an important trading post, Macau was a center of activity for Catholic missionaries, as it was seen as a gateway for the conversion of the vast populations of China and Japan.
Portugal continued to pay rent to China until 1849, when the Portuguese abolished the Chinese customs house and declared Macau's "independence", a year which also saw Chinese retaliation and finally the assassination of Gov. Ferreira do Amaral. Portugal gained control of the island of Wanzai (Lapa by the Portuguese and now as Wanzaizhen), to the northwest of Macau and which now is under the jurisdiction of Zhuhai (Xiangzhou District), in 1849 but relinquished it in 1887.
From 1848 to about the early 1870s, Macau was the infamous transit port of a trade of coolies (or slave labourers) from southern China. Most of them were kidnapped from the Guangdong province and were shipped off in packed vessels to Cuba, Peru, or other South American ports to work on plantations or in mines. Many died on the way there due to malnutrition, disease, or other mistreatment. The Dea del Mar which had set sail to Callaofrom Macau in 1865 with 550 Chinese on board, arrived in Tahiti with only 162 of them still alive
Macau became a refugee center during WWII causing its population to climb from about 200 thousand to about 700 thousand people within a few years. There had been also food shortages in Macau leading to food rationing and in some cases cannibalism.
Unlike in the case of Portuguese Timor which was occupied by the Japanese in 1942 along with Dutch Timor, the Japanese respected Portuguese neutrality in Macau, but only up to a point. As such, Macau enjoyed a brief period of economic prosperity as the only neutral port in South China, after the Japanese had occupied Guangzhou (Canton) and Hong Kong. In August 1943, Japanese troops seized the British steamer Sian in Macau and killed about 20 guards. The next month they demanded the installation of Japanese "advisors" under the alternative of military occupation. The result was that a virtual Japanese protectorate was created over Macau. Japanese domination ended in August 1945.
When it was discovered that neutral Macau was planning to sell aviation fuel to Japan, aircraft from the USS Enterprise bombed and strafed the hangar of the Naval Aviation Centre on 16 January 1945 to destroy the fuel. American air raids on targets in Macau were also made on 25 February and 11 June 1945. Following Portuguese government protest, in 1950 the United States paid US$20,255,952 to the government of Portugal.
Portugal and the People's Republic of China established diplomatic relations on 8 February 1979, and Beijing acknowledged Macau as "Chinese territory under Portuguese administration." A year later, Gen. Melo Egidio became the first governor of Macau to pay an official visit to Beijing.
The visit underscored both parties' interest in finding a mutually agreeable solution to Macau's status. A joint communiqué signed 20 May 1986 called for negotiations on the Macau question, and four rounds of talks followed between 30 June 1986 and 26 March 1987. The Joint Declaration on the Question of Macau was signed in Beijing on 13 April 1987, setting the stage for the return of Macau to full Chinese sovereignty as a Special Administrative Region on 20 December 1999.
After four rounds of talks, "the Joint Declaration of the Government of the People's Republic of China and the Government of the Republic of Portugal on the Question of Macau" was officially signed in April 1987. The two sides exchanged instruments of ratification on 15 January 1988 and the Joint Declaration entered into force. During the transitional period between the date of the entry into force of the Joint Declaration and 19 December 1999 the Portuguese government was responsible for the administration of Macau.
The Basic Law of the Macau Special Administrative Region of the People's Republic of China, was adopted by the National People's Congress (NPC) on 31 March 1993 as the constitutional law for Macau, taking effect on 20 December 1999.
The PRC has promised that, under its "one country, two systems" formula, China's socialist economic system will not be practised in Macau and that Macau will enjoy a high degree of autonomy in all matters except foreign and defence affairs until at least 2049, fifty years after the handover.
Thus the history of European colonisation of Asia ended where it began. Although offered control of Macau in the 1970s, the Chinese deemed the time "not yet ripe" and preferred to wait until December 1999—the very end of the millennium, two years after the Hong Kong handover—to close this chapter of history.