the church's autonomy from the Danish crown was not settled until some years after her son's maturity, but Margaret continued to negotiate with the Pope until she solved the matter, even after her mandate as regent was terminated. She was also faced with having to protect her son's right to the throne against the claims of the sons of her brother-in-law Abel of Denmark, whose claims to the throne was raised by Abel's widow Matilda of Holstein, as well as given the responsibility of the four daughters of her other brother-in-law Eric IV of Denmark, Sophia, Ingeborg, Jutta and Agnes. Her son's succession overrode the rights of the descendants of earlier monarchs, counter to the dictates of agnatic seniority. The conflict with the sons of Matilda of Holstein resulted in warfare with the counts of Holstein. After a loss in Lohede in 1261, Margaret, together with her son, the young Eric V were imprisoned by the Count of Holstein. They soon managed to escape with help from Albert of Brunswick. She was not able to prevent the marriage alliances between Abel's widow Matilda of Holstein and Birger Jarl, or Eric IV's daughters Sophia and Ingeborg to the kings of Norway and Sweden, but she was able to prevent Eric IV's remaining daughters Jutta and Agnes from similar marriage alliances by placing them in the convent St. Agnes' Priory, Roskilde. In 1263, Margaret successfully wrote to Pope Urban IV, asking him to allow women to inherit the Danish throne, in a final effort to prevent the claims of the Abel-fraction on the Danish throne. This would make it possible for one of Eric's sisters to become reigning Queen of Denmark in the event of Erik V's dying before he had any children. In her own time, Margaret had a reputation as a competent and enlightened regent. Her nicknames, "Sprænghest" ('Burst-horse') and "Sorte Grete" ('Black Greta') reveal a strong-willed, energetic personality. Later life Margaret retired as regent in 1264, when her son was declared an adult, and she officially settled with her own court in her personal residence Nykøbing Slot on Falster. She continued to play a role in Danish politics and kept an interest and certain influence over Danish state affairs. In 1266, her son the king granted her the rulership of Danish Estonia, and made her ruling countess of the province for life. She actively settled the affairs of Estonia