After the death of Ferdinand the palace passed into the possession of his second wife Elisa Hensler, Countess of Edla. The latter then sold the palace to King Luís, who wanted to retrieve it for the royal family, and thereafter the palace was frequently used by the family. In 1889 it was purchased by the Portuguese State, and after the Republican Revolution of 1910 it was classified as a national monument and transformed into a museum. The last queen of Portugal, Queen Amélia, spent her last night at the palace before leaving the country in exile.