Costa Rica remained a peripheral colony of the empire until independence as part of the short-lived First Mexican Empire.