 In 1821, Juan de O'Donojú, the last viceroy of New Spain, came to the port to leave for Spain.However, until 1823, Spanish troops continued to occupy San Juan de Ulúa Fort.In 1826, the city would receive the first of its four titles of "heroic city" for confronting these remaining Spanish troops.