In 1270, when Mary was only twelve years of age, she married the future Charles II of Naples. The wedding took place in Naples on 6 August 1270. The marriage was intended as a double alliance between Naples and Hungary to support the intended conquest of Byzantium by Naples, but it did not serve its purpose as her brother in 1272 made an alliance with Byzantium as well. Maria accompanied Charles on his trips and spent 1278-82 in Provence with her consort. In 1284, she made her first political act: when Charles was taken captive by Aragon, she made the decision to free the Aragonese prisoner Beatrice of Hohenstaufen. In 1285, Charles became monarch but remained in Aragonese prison. She did not take part in the regency for him in Naples, but remained in Provence, where she did take part in the administration from time to time, though she was not formal regent. In 1288, she took part in the negotiations of her consort's release, and the same year, she made a peace treaty with Aragon. Charles was released the same year, and they returned to Naples together. In 1290-94, she was regent for him in Provence.