During most of the colonial period, Costa Rica was the southernmost province of the Captaincy General of Guatemala, nominally part of the Viceroyalty of New Spain. In practice, the captaincy general was a largely autonomous entity within the Spanish Empire. Costa Rica's distance from the capital of the captaincy in Guatemala, its legal prohibition under mercantilist Spanish law from trade with its southern neighbor Panama, then part of the Viceroyalty of New Granada (i.e. Colombia), and lack of resources such as gold and silver, made Costa Rica into a poor, isolated, and sparsely-inhabited region within the Spanish Empire. Costa Rica was described as "the poorest and most miserable Spanish colony in all America" by a Spanish governor in 1719.