John III agreed to recognize the legitimacy of the marriage between Jacqueline and John IV of Brabant if only to receive a high financial compensation from the government for the next five years of the regions dominated by the spouses; however, the intervention of Pope Martin V finally ended the controversy with granting the papal dispensation on May 1419. John IV, always heavily indebted and against the will of his wife signed with John III the Treaty of St. Martinsdyk, under which he gave to Jacqueline's uncle full custody over Holland and Zeeland for the next 12 years. In exchange, John III gave a monetary compensation to the couple and left them the County of Hainaut; however, this was a little consolation for Jacqueline, whose subjects of Holland, Zeeland and Friesland were released from their oath of allegiance under the terms of the treaty. Finally, John IV also pledged Hainaut to improve his financial situation; for Jacqueline, this was enough: she and her allies began to want the formal separation from John IV.