Macau was a colony of Portugal, ruled by a governor for 442 years from 1557 (except for 4 years of during WWII, because of Japanese respect to Portuguese neutrality) until 1999, when it was returned to Chinese sovereignty. China had to accept some conditions, stipulated in the Joint Declaration on the Question of Macau, such as the drafting and adoption of Macau's mini-constitution before its return. Like Hong Kong, the Basic Law ensured Macau will retain its capitalist economic system and own currency (the pataca), legal system (which is based on Portuguese civil law), legislative system, and people's rights and freedom for 50 years, as a special administrative region (SAR) of China. Set to expire in 2049, the current agreement has permitted Macau to function as its own entity in many international settings (e.g., WTO and the Olympics) rather than as a part of China.