The human history of Macau stretches back up to 6,000 years, and includes many different and diverse civilizations and periods of existence. Evidence of human and culture dating back 4,000 to 6,000 years has been discovered on the Macau Peninsula and dating back 5,000 years on Coloane Island.
During the Qin Dynasty (221 - 206 BC), the region now called Macau came under the jurisdiction of Panyu County, Nanhai Prefecture of the province of Guangdong. It was administratively part of Dongguan Prefecture in the Jin Dynasty (265 - 420 AD), and alternated under the control of Nanhai and Dongguan in later dynasties. In 1152, during the Song Dynasty (960 - 1279 AD), it was under the jurisdiction of the new Xiangshan County.
Since the 5th century, merchant ships traveling between Southeast Asia and Guangzhou used the region as a way stop for refuge, fresh water, and food. The first recorded inhabitants of the area are some 50,000 people seeking refuge in Macau from invading Mongols in 1277, during the Southern Song Dynasty. They were able to defend their settlements and establish themselves there. Mong H¡§¢ has long been the center of Chinese life in Macau and the site of what may be the region's oldest temple, a shrine devoted to the Buddhist Guanyin (Goddess of Mercy). Later in the Ming Dynasty (1368 - 1644 AD), fishermen migrated to Macau from various parts of Guangdong and Fujian provinces and built the A-Ma Temple where they prayed for safety on the sea. The Hoklo Boat people were the first to show interest in Macau as a trading centre for the southern provinces. However, Macau did not develop as a major settlement until the Portuguese arrived in the 16th century.