On the restoration of a Portuguese ruling dynasty, in 1640 he was imprisoned by order of Olivares, and when released hastened to offer his sword to John IV. He travelled to England, where he spent some time at the court of Charles I, and thence passing over to Holland assisted the Portuguese ambassador to equip a fleet in aid of Portugal, and himself brought it safely to Lisbon in October 1641.