By virtue of descent from his maternal grandparents, Ferdinand II of Aragon and Isabella I of Castile, in 1516 Charles I of Spain became the first king to rule the Crowns of Castile and Aragon simultaneously by his own right. Following the death of his paternal (House of Habsburg) grandfather, Maximilian I, Holy Roman Emperor, he was also elected Charles V, Holy Roman Emperor, in 1519. In the 16th century, the Catalan population began a demographic recovery and some measure of economic recovering. The reign of Charles V was a relative harmonious period, during which Catalonia generally accepted the new structure of Spain, despite its own marginalization. As the focus of Spanish maritime power and of European rivalry shifted to the Atlantic, the Kingdom of Valencia became the most important kingdom of the Aragonese Crown, eclipsing Barcelona. The reign of Philip II marked the beginning of a gradual process of stagnation of Catalan economy, language, and culture. Among the most negative elements of the period were a rise in piracy along the coasts and banditry in the interior.