Andrew was the second son of King Béla III and Béla's first wife, Agnes of Antioch. The year of Andrew's birth is not known, but modern historians agree that he was born around 1177. Andrew was first mentioned in connection to his father's invasion of the Principality of Halych in 1188. That year, Béla III invaded Halych upon the request of its former prince, Vladimir II Yaroslavich, who had been expelled by his subjects. Béla forced the new prince, Roman Mstislavich, to flee. After conquering Halych, he granted it to Andrew. Béla also captured Vladimir Yaroslavich and imprisoned him in Hungary.
After Béla's withdrawal from Halych, Roman Mstislavich returned with the assistance of Rurik Rostislavich, Prince of Belgorod Kievsky. They tried to expel Andrew and his Hungarian retinue, but the Hungarians routed the united forces of Mstislavich and Rostislavich. A group of local boyars offered the throne to Rostislav Ivanovich, a distant cousin of the imprisoned Vladimir Yaroslavich. Béla III sent reinforcements to Halych, enabling Andrew's troops to repel the attacks. Andrew's reign remained unpopular in Halych, because the Hungarian soldiers insulted local women and did not respect Orthodox churches. Consequently, the local boyars allied with their former prince, Vladimir Yaroslavich, who had escaped from captivity and returned to Halych. Duke Casimir II of Poland also supported Vladimir Yaroslavich, and they expelled Andrew and his retinue from the principality in August 1189 or 1190. Andrew returned to Hungary after his defeat. He did not receive a separate duchy from his father, who only gave him estates and money. On his deathbed, Béla III, who had pledged to lead a crusade to the Holy Land, ordered Andrew to fulfill his vow. Andrew's father died on 23 April 1196, and Andrew's older brother, Emeric, succeeded him.
Andrew used the funds that he inherited from his father to recruit supporters among the Hungarian lords. He also formed an alliance with Leopold VI, Duke of Austria, and they plotted against Emeric. Their united troops routed the royal army at Mački, Slavonia, in December 1197. Under duress, King Emeric gave Croatia and Dalmatia to Andrew as an appanage. In practice, Andrew administered Croatia and Dalmatia as an independent monarch. He minted coins, granted land and confirmed privileges. He cooperated with the Frankopans, Babonići, and other local lords. The Canons Regular of the Holy Sepulchre settled in the province during his rule. Taking advantage of Miroslav of Hum's death, Andrew invaded Hum and occupied at least the land between the Cetina and Neretva rivers. He styled himself, "By the grace of God, Duke of Zadar and of all Dalmatia, Croatia and Hum" in his charters.
Pope Innocent III urged Andrew to lead a crusade the Holy Land, but Andrew hatched a new conspiracy against Emeric with the help of John, Abbot of Pannonhalma, Boleslaus, Bishop of Vác, and many other prelates and lords. The Pope threatened him with excommunication if he failed to fulfill his father's vow, but Andrew did not yield. The conspiracy was uncovered on 10 March 1199, when King Emeric seized letters written by Andrew's partisans to Bishop Boleslaus. That summer, royal troops routed Andrew's army near Lake Balaton, and Andrew fled to Austria. A papal legate mediated a reconciliation between Andrew and Emeric, who allowed Andrew to return to Croatia and Dalmatia in 1200. Andrew married Gertrude of Merania; her father, Berthold, Duke of Merania, owned extensive domains in the Holy Roman Empire along the borders of Andrew's duchy.
When Emeric's son, Ladislaus, was born around 1200, Andrew's hopes to succeed his brother as king were shattered. Pope Innocent confirmed the child's position as heir to the crown, declaring that Andrew's future sons would only inherit Andrew's duchy. Andrew planned a new rebellion against his brother, but King Emeric captured him without resistance near Varaždin in October 1203.
[All] the magnates of the kingdom and almost the whole of the Hungarian army deserted [King Emeric] and unlawfully sided with Duke Andrew. Very few men indeed remained with the king, and even they were terrified at the extent of the insurrection, and did not dare to urge the king to hope for success, but rather advised him to flee. Then it happened that one day both sides had drawn close to each other and were beginning to prepare themselves in earnest for battle. ... [After] much wise thought, with inspiration from heaven [King Emeric] found a successful way by which he might recover his right to the kingdom and still remain guiltless of bloodshed. So he said to his men, "Stay here a while, and do not follow me." Then he laid down his weapons, and taking only a leafy bough in his hand he walked slowly into the enemy ranks. As he passed through the midst of the armed multitude, he cried out in a loud and strong voice, "Now I shall see who will dare to raise a hand to shed the blood of the royal lineage!" Seeing him, all fell back, and not daring even to mutter, they left a wide passage for him on either side. And then when [King Emeric] reached his brother, he took him, and leading him outside the body of troops, he sent him to a certain castle for custody.
Andrew was first imprisoned in the fort of Gornji Kneginec, then in Esztergom. Alexander of the Hont-Pázmány clan freed him in early 1204. Having fallen ill, King Emeric had his son, Ladislaus, crowned king on 26 August. Andrew reconciled with his dying brother, who entrusted him with "the guardianship of his son and the administration of the entire kingdom until the ward should reach the age of majority", according to the nearly contemporaneous Thomas the Archdeacon.
King Emeric died on 30 November 1204. Andrew governed the kingdom as Ladislaus's regent, but he counted his regnal years from the time of his brother's death, showing that he already regarded himself as the lawful monarch during Ladislaus III's reign. Pope Innocent told Andrew that he should remain loyal to Ladislaus. Instead, Andrew seized the money that Emeric had deposited for Ladislaus in Pilis Abbey. Ladislaus's mother, Constance of Aragon, fled from Hungary, taking her son to Austria. Andrew prepared to war against Leopold VI, Duke of Austria, but Ladislaus suddenly died in Vienna on 7 May 1205.
John, Archbishop of Kalocsa, crowned Andrew king in Székesfehérvár on 29 May 1205. Andrew introduced a new policy for royal grants, which he called "new institutions" in one of his charters. He distributed large portions of the royal domain—royal castles and all estates attached to them—as inheritable grants to his supporters, declaring that "the best measure of a royal grant is its being immeasurable." His "new institutions" altered the relations between the monarchs and the Hungarian lords. During the previous two centuries, a lord's status primarily depended on the income he received for his services to the monarch; after the introduction of the "new institutions", their inheritable estates yielded sufficient revenues. This policy also diminished the funds upon which the authority of the ispáns, or heads, of the counties—who were appointed by the monarchs—had been based.
During his reign, Andrew was intensely interested in the internal affairs of his former principality of Halych. He launched his first campaign to recapture Halych in 1205 or 1206. Upon the boyars' request, he intervened against Vsevolod Svyatoslavich, Prince of Chernigov, and his allies on behalf of Daniel Romanovich, the child-prince of Halych, and Lodomeria. Svyatoslavich and his allies were forced to withdraw. Andrew adopted the title of "King of Galicia and Lodomeria", demonstrating his claim to suzerainty in the two principalities. After Andrew returned to Hungary, Vsevolod Svyatoslavich's distant cousin, Vladimir Igorevich, seized both Halych and Lodomeria, expelling Daniel Romanovich and his mother. They fled to Leszek I of Poland, who suggested that they visit Andrew. However, Vladimir Igorevich "sent many gifts" to both Andrew and Leszek, dissuading "them from attacking him" on behalf of Romanovich, according to the Galician–Volhynian Chronicle. Vladimir Igorevich's rebellious brother, Roman Igorevich, soon came to Hungary, seeking Andrew's assistance. Roman returned to Halych and expelled Vladimir Igorevich with the help of Hungarian auxiliary troops.
Andrew confirmed the liberties of two Dalmatian towns—Split and Omiš—and issued a new charter listing the privileges of the archbishops of Split in 1207. Taking advantage of a conflict between Roman Igorevich and his boyars, Andrew sent troops to Halych under the command of Benedict, son of Korlát. Benedict captured Roman Igorevich and occupied the principality in 1208 or 1209. Instead of appointing a new prince, Andrew made Benedict governor of Halych. Benedict "tortured boyars and was addicted to lechery", according to the Galician–Volhynian Chronicle. The boyars offered the throne to Mstislav Mstislavich, Prince of Zvenigorod, if he could overthrow Benedict. Mstislav Mstislavich invaded Halych, but he could not defeat Benedict.
Queen Gertrude's two brothers, Ekbert, Bishop of Bamberg, and Henry II, Margrave of Istria, fled to Hungary in 1208 after they were accused of participating in the murder of Philip, King of the Germans. Andrew granted large domains to Bishop Ekbert in the Szepesség region (now Spiš, Slovakia). Gertrude's youngest brother, Berthold, had been Archbishop of Kalocsa since 1206; he was made Ban of Croatia and Dalmatia in 1209. Andrew's generosity towards his wife's German relatives and courtiers discontented the local lords. According to historian Gyula Kristó, the anonymous author of The Deeds of the Hungarians referred to the Germans from the Holy Roman Empire when he sarcastically mentioned that "now ... the Romans gaze on the goods of Hungary." In 1209, Zadar, which had been lost to the Venetians, was liberated by one of Andrew's Dalmatian vassals, Domald of Sidraga, but the Venetians recaptured the town a year later.
Roman Igorevich reconciled with his brother, Vladimir Igorevich, in early 1209 or 1210. Their united forces vanquished Benedict's army, expelling the Hungarians from Halych. Vladimir Igorevich sent one of his sons, Vsevolod Vladimirovich, "bearing gifts to the king in Hungary" to appease Andrew, according to the Galician–Volhynian Chronicle. A group of discontented Hungarian lords offered the crown to Andrew's cousins, the sons of Andrew's uncle, Géza; they lived in "Greek land". However, the cousins' envoys were captured in Split in 1210. In the early 1210s, Andrew sent "an army of Saxons, Vlachs, Székelys and Pechenegs" commanded by Joachim, Count of Hermannstadt, (now Sibiu, Romania) to assist Boril of Bulgaria's fight against three rebellious Cuman chieftains. Around the same time, Hungarian troops occupied Belgrade and Barancs (now Braničevo, Serbia), which had been lost to Bulgaria under Emeric. Andrew's army defeated the Cumans at Vidin. Andrew granted the Barcaság (now Țara Bârsei, Romania) to the Teutonic Knights. The Knights were to defend the easternmost regions of the Kingdom of Hungary against the Cumans and encourage their conversion to Catholicism.
A group of boyars, who were alarmed by the despotic acts of Vladimir Igorevich, asked Andrew to restore Daniel Romanovich as ruler of Halych in 1210 or 1211. Andrew and his allies—Leszek I of Poland and at least five Rus' princes—sent their armies to Halych and restored Daniel Romanovich. Local boyars expelled Daniel Romanovich's mother in 1212. She persuaded Andrew to personally lead his army to Halych. He captured Volodislav Kormilchich, the most influential boyar, and took him to Hungary. After Andrew withdrew from Halych, the boyars again offered the throne to Mstislav Mstislavich, who expelled Daniel Romanovich and his mother from the principality. Andrew departed for a new campaign against Halych in summer 1213. During his absence, Hungarian lords who were aggrieved at Queen Gertrude's favoritism towards her German entourage captured and murdered her and many of her courtiers in the Pilis Hills on 28 September. When he heard of her murder, Andrew returned to Hungary and ordered the execution of the murderer, Peter, son of Töre. However, Peter's accomplices, including Palatine Bánk Bár-Kalán, did not receive severe punishments. A group of Hungarian lords, whom Andrew called "perverts" in one of his letters, was plotting to dethrone Andrew and crown his eldest son, the eight-year-old Béla, but they failed to dethrone him and could only force Andrew to consent to Béla's coronation in 1214.
Andrew and Leszek of Poland signed a treaty of alliance, which obliged Andrew's second son, Coloman, to marry Leszek of Poland's daughter, Salomea. Andrew and Leszek jointly invaded Halych in 1214, and Coloman was made prince. He agreed to cede Przemyśl to Leszek of Poland. The following year, Andrew returned to Halych and captured Przemyśl. Leszek of Poland soon reconciled with Mstislav Mstislavich; they jointly invaded Halych and forced Coloman to flee to Hungary. A new officer of state, the treasurer, was responsible for the administration of the royal chamber from around 1214 onwards. However, royal revenues had significantly diminished. Upon the advice of the treasurer, Denis, son of Ampud, Andrew imposed new taxes and farmed out royal income from minting, salt trade and custom duties. The yearly exchange of coins also produced more revenue for the royal chamber. However, these measures provoked discontent in Hungary.
Andrew signed a new treaty of alliance with Leszek of Poland in the summer of 1216. Leszek and Andrew's son, Coloman, invaded Halych and expelled Mstislav Mstislavich and Daniel Romanovich, after which Coloman was restored. That same year, Andrew met Stephen Nemanjić, Grand Prince of Serbia, in Ravno (now Ćuprija, Serbia). He persuaded Stephen Nemanjić to negotiate with Henry, Latin Emperor of Constantinople, who was the uncle of Andrew's second wife, Yolanda de Courtenay. Stephen Nemanjić was crowned king of Serbia in 1217. Andrew planned to invade Serbia, but Stephen Nemanjić's brother, Sava, dissuaded him, according to both versions of the Life of Sava.
In July 1216, the newly elected Pope Honorius III once again called upon Andrew to fulfill his father's vow to lead a crusade. Andrew, who had postponed the crusade at least three times (in 1201, 1209 and 1213), finally agreed. Steven Runciman, Tibor Almási and other modern historians say that Andrew hoped that his decision would increase his likelihood of being elected as Latin Emperor of Constantinople, because his wife's uncle, Emperor Henry, had died in June. According to a letter written by Pope Honorius in 1217, envoys from the Latin Empire had actually informed Andrew that they planned to elect either him or his father-in-law, Peter of Courtenay, as emperor. The barons of the Latin Empire elected Peter of Courtenay in the summer of 1216.
Andrew sold and mortgaged royal estates to finance his campaign, which became part of the wider Fifth Crusade. He renounced his claim to Zadar in favor of the Republic of Venice so that he could secure shipping for his army. He entrusted Hungary to Archbishop John of Esztergom, and gave Croatia and Dalmatia to Pontius de Cruce, the Templar Prior of Vrana. In July 1217, Andrew departed from Zagreb, accompanied by Leopold VI of Austria and Otto I, Duke of Merania. His army was so large—at least 10,000 mounted soldiers and uncountable infantrymen—that most of it stayed behind when Andrew and his men embarked in Split two months later. The ships transported them to Acre, where they landed in October.
The leaders of the crusade included John of Brienne, King of Jerusalem, Leopold of Austria, the Grand Masters of the Hospitallers, the Templars and the Teutonic Knights. They held a war council in Acre, with Andrew leading the meeting. In early November, the crusaders launched a campaign for the Jordan River, forcing Al-Adil I, Sultan of Egypt, to withdraw without fighting; the crusaders then pillaged Beisan. After the crusaders returned to Acre, Andrew did not participate in any other military actions. Instead, he was collecting relics, including a water jug allegedly used at the marriage at Cana, the heads of Saint Stephen and Margaret the Virgin, the right hands of the Apostles Thomas and Bartholomew and a part of Aaron's rod. If Thomas the Archdeacon's report of certain "evil and audacious men" in Acre who "treacherously passed him a poisoned drink" is reliable, Andrew's inactivity was because of illness.
Andrew decided to return home at the very beginning of 1218, even though Raoul of Merencourt, Latin Patriarch of Jerusalem, threatened him with excommunication. Andrew first visited Tripoli and participated in the marriage of Bohemond IV of Antioch and Melisende of Lusignan on 10 January. From Tripoli, he travelled to Cilicia, where he and Leo I of Armenia betrothed Andrew's youngest son, Andrew, and Leo's daughter, Isabella. Andrew proceeded through the Seldjuk Sultanate of Rum before arriving in Nicaea (now İznik, Turkey). His cousins (the sons of his uncle, Géza) attacked him when he was in Nicaea. He arranged the marriage of his oldest son, Béla, to Maria Laskarina, a daughter of Emperor Theodore I Laskaris. When he arrived in Bulgaria, Andrew was detained until he "gave full surety that his daughter would be united in marriage" to Ivan Asen II of Bulgaria, according to Thomas the Archdeacon. Andrew returned to Hungary in late 1218. Andrew's "crusade had achieved nothing and brought him no honor", according to historian Thomas C. Van Cleve. Oliver of Padernborn, James of Vitry and other 13th-century authors blamed Andrew for the failure of crusade.
When he returned to Hungary, Andrew complained to Pope Honorius that his kingdom was "in a miserable and destroyed state, deprived of all of its revenues." A group of barons had even expelled Archbishop John from Hungary. Andrew was in massive debt because of his crusade, which forced him to impose extraordinarily high taxes and debase coinage. In 1218 or 1219, Mstislav Mstislavich invaded Halych and captured Andrew's son, Coloman. Andrew compromised with Mstislavich. Coloman was released, and Andrew's youngest son and namesake was betrothed to Mstislavich's daughter. In 1220, a group of lords persuaded Andrew to make his eldest son, Béla, the Duke of Croatia, Dalmatia and Slavonia.
Andrew employed Jews and Muslims to administer royal revenues, which caused a discord between Andrew and the Holy See starting in the early 1220s. Pope Honorius urged Andrew and Queen Yolanda to prohibit Muslims from employing Christians. Andrew confirmed the privileges of clergymen, including their exemption from taxes and their right to be exclusively judged by church courts, but also prohibited the consecration of udvornici, castle folk and other serfs in early 1222. However, a new conflict emerged between Andrew and the Holy See after he persuaded Béla to separate from his wife, Maria Laskarina. An "immense crowd" approached Andrew around June 1222, demanding "grave and unjust things", according to a letter of Pope Honorius. Actually, the royal servants—who were landowners directly subject to the monarch's power and obliged to fight in the royal army—assembled, forcing Andrew to dismiss Julius Kán and his other officials. Andrew was also forced issue a royal charter, the Golden Bull of 1222. The charter summarized the liberties of the royal servants, including their exemption from taxes and the jurisdiction of the ispáns. The last clause of the Golden Bull authorized "the bishops as well as the other barons and nobles of the realm, singularly and in common" to resist the monarch if he did not honor the provisions of the charter. The Golden Bull clearly distinguished the royal servants from the king's other subjects, which led to the rise of the Hungarian nobility. The Golden Bull is commonly compared with England's Magna Carta — a similar charter which was sealed a few years earlier in 1215. A significant difference between them is that, in England, the settlement strengthened the position of all the royal subjects but, in Hungary, the aristocracy came to dominate both the crown and the lower orders.
Andrew discharged Palatine Theodore Csanád and restored Julius Kán in the second half of 1222. The following year, Pope Honorius urged Andrew to launch a new crusade. If the report of the Continuatio Claustroneuburgensis is reliable, Andrew took the cross to show that he intended launch a new crusade, but no other sources mention this event. Andrew planned to arrange a new marriage for his eldest son, Béla, but Pope Honorius mediated a reconciliation between Béla and his wife in the autumn of 1223. This angered Andrew, and Béla fled to Austria. He returned in 1224, after the bishops persuaded Andrew to forgive him.
In his Diploma Andreanum of 1224, Andrew confirmed the privileges of the "Saxons" who inhabited the region of Hermannstadt in southern Transylvania (now Sibiu, Romania). The following year, he launched a campaign against the Teutonic Knights, who had attempted to eliminate his suzerainty. The Knights were forced to leave Barcaság and the neighboring lands. Andrew's envoys and Leopold VI of Austria signed a treaty on 6 June, which ended the armed conflicts along the Hungarian-Austrian border. As part of the treaty, Leopold VI paid an indemnification for the damages that his troops had caused in Hungary. Andrew made his oldest son, Béla, Duke of Transylvania. Béla's former duchy was given to Andrew's second son, Coloman, in 1226. Duke Béla started expanding his suzerainty over the Cumans, who inhabited the lands east of the Carpathian Mountains. Andrew launched a campaign against Mstislav Mstislavich in 1226, because the latter refused to grant Halych to Andrew's youngest son despite a previous compromise. Andrew besieged and captured Przemyśl, Terebovl, and other fortresses in Halych. However, his troops were routed at Kremenets and Zvenigorod, forcing him to withdraw. Despite his victories, Mstislavich ceded Halych to Andrew's son in early 1227.
In 1228, Andrew authorized his son, Béla, to revise his previous land grants. Pope Honorius also supported Béla's efforts. Béla confiscated the domains of two noblemen, Simon Kacsics and Bánk Bár-Kalán, who had taken part in the conspiracy to murder Queen Gertrude. In 1229, upon Béla's proposal, Andrew confirmed the privileges of the Cuman chieftains who had subjected themselves to Béla. Robert, Archbishop of Esztergom, made a complaint about Andrew to the Holy See, because Andrew continued to employ Jews and Muslims. Pope Gregory IX authorized the archbishop to perform acts of religious censure to persuade Andrew to dismiss his non-Christian officials. Under duress, Andrew issued a new Golden Bull in 1231, which confirmed that Muslims were banned from employment, and empowered the Archbishop of Esztergom to excommunicate the king if he failed to honor the provisions of the new Golden Bull. In the second half of the year, Andrew invaded Halych and restored his youngest son, Andrew, to the throne.
Archbishop Robert excommunicated Palatine Denis and put Hungary under an interdict on 25 February 1232, because the employment of Jews and Muslims continued despite the Golden Bull of 1231. Since the archbishop accused the Muslims of persuading Andrew to seize church property, Andrew restored properties to the archbishop, who soon suspended the interdict. Upon Andrew's demand, Pope Gregory sent Cardinal Giacomo Pecoraria as his legate to Hungary and promised that nobody would be excommunicated without the pope's special authorization. Although Andrew departed for Halych to support his youngest son in a fight against Daniel Romanivich, he continued his negotiations with the papal legate. On 20 August 1233, in the forests of Bereg, he vowed that he would not employ Jews and Muslims to administrate royal revenues, and would pay 10,000 marks as compensation for usurped Church revenues. Andrew repeated his oath in Esztergom in September.
Andrew and Frederick II, Duke of Austria, signed a peace treaty in late 1233. Andrew, who had been widowed, married the 23-year-old Beatrice D'Este on 14 May 1234, even though his sons were sharply opposed to his third marriage. John, Bishop of Bosnia, put Hungary under a new interdict in the first half of 1234, because Andrew had not dismissed his non-Christian officials despite his oath of Bereg. Andrew and Archbishop Robert of Esztergom protested against the bishop's act at the Holy See.
Danilo Romanovich laid siege to Halych, and Andrew's youngest son died during the siege in the autumn of 1234. However, Andrew stormed Austria in the summer of 1235, forcing Duke Frederick to pay an indemnification for damages that his troops had caused while raiding Hungary. Upon Andrew's demand, Pope Gregory declared on 31 August that Andrew and his sons could only be excommunicated by the authorization of the Holy See. Andrew died on 21 September, and was buried in Egres Abbey.
Andrew's first wife, Gertrude of Merania, was born around 1185, according to historian Gyula Kristó. Their first child, Mary, was born in 1203 or 1204. She became the wife of Ivan Asen II of Bulgaria. Andrew's eldest son, Béla, was born in 1206. He later succeeded his father as king. Béla's younger sister, Elisabeth, was born in 1207. She married Louis IV, Landgrave of Thuringia. She died in 1231 and was canonized during Andrew's life. Andrew's second son, Coloman, was born in 1208. His third son, Andrew, was born around 1210. Coloman and Andrew each ruled the Principality of Halych for a short period.
Two years after his first wife was murdered, Andrew married Yolanda de Courtenay, who was born around 1198. Their only child, Yolanda, was born around 1219 and married James I of Aragon. Andrew's third wife, Beatrice D'Este, was about twenty-three when they married in 1234. She gave birth to a son, Stephen, after Andrew's death. However, Andrew's two older sons, Béla and Coloman, accused her of adultery and considered her child to be a bastard. Her grandson, Andrew, became the last monarch of the House of Árpád.