The marriage was the result of the Treaty of Ryswick , one of its conditions being that the Duchy of Lorraine , which had been for many years in the possession of France , be restored to Leopold , a son of Charles V , Duke of Lorraine . The marriage was the result of the Treaty of Ryswick , one of its conditions being that the Duchy of Lorraine , which had been for many years in the possession of France , be restored to Leopold Joseph , a son of Charles V , Duke of Lorraine .