Hajji Ebrahim Shirazi
Hajji Ebrahim Shirazi (; 1745–1801), also known by his honorific title E'temad ol-Dowleh (), was an Iranian statesman who served as the kalantar (lord mayor) of the city of Shiraz during the late Zand era and later as the first grand vizier of Qajar Iran. Ebrahim inherited his father's title, kadkhoda (warden) of the Balakaft quarter of Shiraz, and later became kadkhoda-bashi (chief warden) of all of the city's areas adjacent to Balakaft. In 1781, Ali-Morad Khan Zand captured Shiraz; to prevent riots, he dismissed all kadkhodas including Hajji Ebrahim, and sent them to Isfahan and fined them 40,000 tomans. To reclaim his titles, Ebrahim helped Jafar Khan Zand capture Shiraz in 1785 and the new Shah appointed him kalantar of Shiraz. When Jafar was assassinated in his palace in 1789, Ebrahim took side of his son Lotf Ali Khan by arresting Sayed Morad Khan and declaring Lotf Ali as the king. After a dispute with Lotf Ali Khan in 1790, Ebrahim changed sides and swore allegiance to Agha Mohammad Khan. In 1791, when Lotf Ali Khan was marching to Kerman, Ebrahim took control of Shiraz and ordered the arrest of all Zand generals. Lotf Ali Khan abandoned his campaigning and returned; he went to the south of Fars, where he clashed with Ebrahim's forces, which resulted in defeat, then marched on and camped Kazerun. Ebrahim requested help from Agha Mohammad Khan, who at the time was conquering Azerbaijan. Agha Mohammad Khan went to Shiraz and appointed Ebrahim as governor of the province. In 1792 Lotf Ali Khan again fought to seize Shiraz but he was defeated and fled to Tabas. In 1794, Lotf Ali Khan was arrested and killed, Agha Mohammad Khan became the new Shah of Iran and Ebrahim became his grand vizier. In this time, Ebrahim became engaged in internal and administrative affairs, and was one of Agha Mohammad Khan's major advisors. In 1795, Ebrahim proposed a coronation ceremony for Mohammad Khan, at which he placed the crown on the king. Ebrahim was present when Agha Mohammad Khan was assassinated in Shusha; he quickly returned to Tehran and proclaimed Fath-Ali, the nephew of the late Shah, the new king, preventing a civil war. Ebrahim remained grand vizier until 1801, when he was killed at the behest of Fath-Ali Shah, who was afraid of Ebrahim's powerful position. Most of Ebrahim's family, with the exception of one of his sons Ali Akbar and his daughter Mahbanu Khanum, were also subsequently killed. Ebrahim's descendants later formed the Qavam family, who became influential in the mid-to-late Qajar period. Some of his descendants like Mirza Abolhassan Khan Ilchi had important roles and were powerful in the royal court. Hajji Ebrahim Shirazi's role in ending the succession war of Karim Khan Zand and transitioning power from Zands to the Qajars, as well as enthroning four kings, made him known as a kingmaker, and marks him as one of the most remarkable politicians in modern Iranian history. Background

Iran in the 18th century 

According to the modern historian, Roger Stevens: "The eighteenth century is a horrible period in Iranian history–horrible to read about, horrible to disentangle, horrible to have tried to live in." An era filled with revolts, famine, disasters and general misery, it is estimated that the population of the country fell from 9 million in the beginning to 6m at the end. After the fall of the Safavid Empire in 1722, it was expected that Iran might disappear altogether, but the emergence of a former general called Nader Quli Beg–later known as Nader Shah– saved it from collapse. His Afsharid Empire, however, soon fell into civil war after his untimely death in 1747. By end of the century, the only remaining ruling member of his dynasty was his grandson, Shahrokh Shah, who ruled the Greater Khorasan in the eastern Iran. In the central Iran, Karim Khan of Zand tribe established himself and his dynasty as the absolute sovereigns over the vast majority of Iran's today's borders (excluding Khorasan). Karim Khan's greatest rival was Mohammad Hasan Khan Qajar, chief of the Qajar Turkomans who dwelt in northern Iran and the city of Astrabad. Karim Khan defeated and killed Mohammad Hassan in 1759. His death was by no means the end of insurgencies in northern Iran. In February 1769, His son, Hossein Qoli Khan Qajar took up arms against the Zand government and sought revenge for his father's death. Hossein Qoli's rebellion lasted for seven years; in 1777, he was eventually killed by some Yomut Turkmens whom he quarreled with. Thus, Agha Mohammad Khan, Mohammad Hassan's eldest son and a eunuch who spent years in Karim Khan's custody in Shiraz, became the new leader of the Qajar tribe. After Karim Khan's death on 1 March 1779, Agha Mohammad Khan fled from Shiraz to Mazandaran and there staged a new rebellion against the Zands. Ebrahim's Familial history 
Hajji Ebrahim Shirazi's family were originally from Qazvin but in the mid-13th century, due to persecution of Jews, one of his ancestors immigrated to Shiraz, where he married the daughter of Qavam al-Din Hassan Shirazi, the minister of the ruling Muzaffarid dynasty. Through this marriage, Ebrahim's family inherited  estates in Shiraz and gradually became kadkhodas (wardens). Ebrahim's grandfather Asher was a famous merchant who converted to Islam and renamed himself Mahmoud. Mahmoud built a maktab named Hashemieh and granted it to Agha Vali, Imam Jom'a of Shiraz. Mahmoud's son Mohammad Hashem was kadkhoda of the Balakaft quarter in the city's southeast. The quarter, owing to its remnant gardens from the Safavid era and the establishment of a trade center by Karim Khan, became one of the richest parts of Shiraz next to the Darb-e Shahzade quarter, which included royal palaces. Due to his family's Jewish background, Mohammad became kadkhoda-bashi (chief warden) of all Jewish parts of the city. In 1747, during the revolt of governor of Fars Qiaqali Charchi Bashi, Nader Shah recaptured Shiraz and Charchi Bashi killed himself. The shah ordered the blinding of Fars' treasurer Mirza Baqer, Shiraz's kalantar Mirza Ismail, and some of the kadkhodas, including Mohammad. With the mediation of the merchants, Nader Shah forgave Mohammad and blinded only one of his eyes. Early life 
Ebrahim was born in 1745 in Shiraz as the third son of Mohammad Hassan Shirazi. He inherited his father's title kadkhoda In the middle years of Karim Khan's reign and allied with a kadkhoda named Mirza Mohammad Kalantar, a mentor and influential figure for young Ebrahim's political outlook. Ebrahim lived through Karim Khan's administration and with Mirza Mohammad's sponsorship, forged acquaintanceships with the remnants of the Safavid bureaucracy such as Mirza Hossein Vafa of the Farahani family. At this time, Ebrahim bought some estates in the neighboring quarters, eventually becoming kadkhoda of all of them. After Karim Khan's death and the civil war between the Zand princes that followed, Ebrahim found an opportunity to increase his influence in Shiraz and to prevent the destruction of his property. In 1779, when Sadeq Khan Zand invaded Shiraz and overthrew Abol-Fath Khan, he blinded or killed those who were in power during Zaki Khan's reign. This purge included some important political and economic figures of Shiraz. A  power vacuum emerged from the deaths of these figures, which gave Ebrahim a chance to further increase his authority. In 1780, Sadeq Khan's army, under the command of his son Jafar Khan, clashed with Ali-Morad Khan Zand over Isfahan. Sadeq borrowed 20,000 tomans from Ebrahim to finance his army and granted him Bagh-e Jahan Nama, a 14th-century Iranian garden. In 1781, Jafar Khan was defeated in Isfahan and retreated to Shiraz. Sadeq's forces were also defeated in several areas, such as Abadeh and Hezar; as a result, Ali-Morad Khan reached and besieged Shiraz in the same year. The siege lasted until February, when the city fell and Sadeq Khan surrendered. On the orders of Ali-Morad Khan, the former king and all of his sons except Jafar, who had escaped, were blinded and later killed. Abol-Fath Khan was also blinded. Ali-Morad Khan, who was unpopular in Shiraz, decided to move the capital to Isfahan. He fined all officials, including Ebrahim, 40,000 Tomans and forced them to move to the new capital. While he was living in Isfahan, Ebrahim made a pilgrimage to Mecca, and maintained his influence over trade centers of Shiraz. In 1785, Jafar Khan raised an army and marched towards Isfahan while Ali-Morad Khan died from an illness in Murcheh Khvort. When news of Ali-Morad's death reached Isfahan, Ebrahim led a revolt against Baqir Khan kalantar of Isfahan and arrested him. When Jafar Khan arrived in Isfahan, Ebrahim greeted him ahead of the rest of the officials, and declared him king and the rightful successor to Karim Khan. Kalantar of Shiraz

Jafar Khan's reign 
Jafar Khan knew Ebrahim was a powerful and popular figure whose help he needed to gain legitimacy. In 1785, Jafar Khan granted Ebrahim the title kalantar of Shiraz. After two months, Jafar Khan was informed Agha Mohammad Khan was marching towards Isfahan. He quickly provided an army to counter Agha Mohammad Khan, but for unknown reason, withdrew to Qom. Another army led by Jafar Khan was defeated near Kashan and he retreated to Shiraz. Jafar's wars caused high taxation in Shiraz, which provoked protests among bazaars, farmers, and merchants. Ebrahim maintained his position; he connected with British merchants in Basra and made a deal with them in which they covered the economic losses in Shiraz and in return they had the right to trade. He knew he must collaborate with important urban bases to consolidate his role as kalantar; alongside Bazzar, there were Lutis, Qashqai, and Bakhtiari tribes and the clergy. These social groups were influential over the core of the city and opposed Jafar Khan's wars; for this reason, Ebrahim organized a meeting and discussed with the representatives of these groups, and gained support for Jafar Khan from most of them. This did not stop the revolt of 1786 led by Mohammad Khan Zand, one of Zaki Khan's sons, who had planned a revolt since 1782, when his youngest brother Akbar Khan was killed by Jafar Khan. Akbar Khan gathered an army of Qashqais and marched towards Shiraz while Jafar Khan was on his way to Isfahan. Ebrahim sent troops under the leadership of Abdullah Khan Zand to fight Mohammad Khan Zand; two armies fought near Shiraz; in the battle, the latter was defeated and killed. Jafar Khan's repeated defeats against Agha Mohammad Khan led to a conspiracy against him. Jafar Khan became aware of this and suspected the leader of the conspiracy was Sayed Morad Khan so he imprisoned Sayed Morad and his two brothers in Arg of Karim Khan. On the night of January 23, 1789, Morad Khan and his supporters escaped from the Arg and attacked Delgosha Garden. Jafar Khan, who was weak because of illness, was killed after some resistance. Sayed Murad Khan beheaded Jafar Khan, went to the streets of Shiraz, and proclaimed himself the new king. An uprising against Morad Khan broke out and was instantly suppressed. Ebrahim was loyal to Jafar Khan but did not participate in this revolt; instead, he wrote a letter to Lotf Ali Khan and informed him of the situation. Coup against Sayed Morad Khan 
Ebrahim knew Lotf Ali Khan was more popular than Sayed Morad Khan among the people, officials and khans of Fars. In correspondence with Lotf Ali, Ebrahim expressed his support and assured him he would help him regain the throne. Lotf Ali Khan went to Bushehr to form an army and asked the governor Sheikh Nasr for help. Nasr could only gave Lotf Ali Khan 300 men so Lotf Ali Khan quickly left for Shiraz. After the news of Lotf Ali Khan's departure reached Sayed Morad Khan, he sent Shah Morad Khan Zand with an army that had been preparing for seven days to confront Lotf Ali Khan. But ten miles from Bushehr, two of Lotf Ali's supporters, Fazl Ali Khan and Naqd Ali Khan, arrested him and waited for Lotf Ali Khan to arrive in Dalaki. Shah Murad Khan was murdered and his army was handed over to Lotf Ali, who now was marching towards Shiraz with more troops. When Ebrahim learned of Lotf Ali Khan's condition, he plotted a coup against Sayed Morad Khan. On May 8, 1789, Ebrahim and plotters, rushed into Arg and arrested Sayed Morad Khan, and executed many of those loyal to him. After learning of these events, Lotf Ali arrived in Shiraz overnight. He ordered that Sayed Morad Khan be blinded and killed and was crowned king on 23 January 1789. Conflict with Lotf Ali Khan 

Since the coronation, the young king and Ebrahim had disputes, one of which was about the trial of Mirza Mahdi. Lotf Ali Khan punished his father's killers at the first opportunity but through the mediation of Ebrahim, he forgave one of the perpetrators, Mirza Mehdi, who was a relative of Ebrahim, but Lotf Ali Khan soon afterwards killed Mirza Mehdi at the instigation of his mother. Ebrahim considered this act a threat to his power and began to avoid the young king. Ebrahim kept his allegiance until May 1790, when Lotf Ali Khan left Shiraz for southern Fars during a siege by Agha Mohammad Khan and set out to conquer Kerman. Lotf Ali appointed his younger son (or according to some sources his younger brother) Khosrow Khan as governor of Fars and Ebrahim as his regent. Lotf Ali Khan did not trust Ebrahim but could not remove him because Ebrahim was a popular figure whose support was crucial in stabilization of his new-found throne, so he took Ebrahim's eldest son Mirza Mohammad as a hostage. At this Ebrahim realized Lotf Ali Khan was against him, and he decided to break his bond with the Zand dynasty that had been established since the Karim Khan era, and to turn his allegiance to Agha Mohammad Khan Qajar. At the time Ebrahim was involved in a power struggle with Zand chiefs and generals who controlled the Arg. Arg of Karim Khan was one of the strategically important areas of Shiraz, so that the rulers of this building had the main power in Shiraz. Knowing this fact, Ebrahim knew that he had to conquer the Arg, in order to take control of the city by purging those loyal to Lotf Ali Khan. Thus not long after Lotf Ali Khan's leaving, Ebrahim rushed into the Arg with a militia force of Lutis under the command of his brother Mohammad Hossein, arrested all Zand generals and then sent a message to his brothers Abdul Rahim Khan and Mohammad Ali, who commanded two regiments of Lotf Ali Khan's infantry, to revolt and arrest him. Although Lotf Ali Khan survived the uprising, his troops were dispersed and he retreated to Shiraz with 200 men. But on his return to Shiraz, the gates of the city did not open for him. The commanders of his army had been separated from the young king by Ebrahim, who had informed them that if they did not abandon Lotf Ali Khan, their families inside the city would be harmed. Lotf Ali Khan, now with fewer men, fled to southern Fars. At first, he wanted to go to his old ally Sheikh Nasser Khan, the governor of Bushehr, but after Sheikh Nasser refused to give him refuge, Lotf Ali Khan went north. Ebrahim, with the help of Reza Qoli Khan Kazeruni, chief of the Qashqais, provided a united army of tribes near Shiraz and set out to possibly arrest Lotf Ali Khan. Ebrahim's army clashed with those of Lotf Ali Khan near Kazerun, ending with a victory for the latter, who successfully conquered the city. Lotf Ali Khan ordered the blinding of Reza Qoli Khan and his son. It was at this time Sultan Ali Khan Zand, one of the Zand princes who had escaped from Shiraz, arrived at Lotf Ali's camp with seventy men. When news of the conquest of Kazerun reached Ebrahim, knowing he might lose to Lotf Ali Khan, Ebrahim wrote a letter to Agha Mohammad Khan, pledged him his (and peoples of Fars') allegiance and offered him 3,000 mares as an additional gift. Agha Mohammad Khan accepted this offer, appointed Ebrahim as governor of Fars, and granted him the title Khan. Siding with Agha Mohammad Khan

Siege of Shiraz 

At the end of 1791, Lotf Ali Khan with 3,000 men went to Shiraz from Kazerun and besieged the city. The leaders of Shiraz expected another member of the Zand dynasty would be enthroned after the removal of Lotf Ali Khan and since this was no longer possible, they intended to ally with Lotf Ali and open the gates. Aware of this, Ebrahim invited the tribal forces to receive their monthly salary then disarmed them and drove them out of the city. These forces, numbering 3,000, joined Lotf Ali Khan outside the city. Because they were unarmed, however, they were not very effective. Lotf Ali Khan besieged the city; his situation outside the city became more stable because he dominated almost all the suburbs of Shiraz. Lotf Ali tried to negotiate with Ebrahim and tried to persuade him to surrender the city and seek refuge with the Ottoman Empire or the Mughal Empire with his family but Ebrahim rejected the offer. Ebrahim wrote a letter to Agha Mohammad Khan and asked him for help. In response, Agha Mohammad Khan sent Baba Khan from Isfahan to Shiraz with an army and ordered Mustafa Khan Davalu to camp in the gardens around Hafeziyeh. At the same time, Ebrahim tried to assassinate Lotf Ali Khan, forcing several Shiraz merchants to write a letter stating they would open one of the city gates on a certain night so the Zand forces could enter Shiraz. When the proposed night came, Lotf Ali and 300 of his companions marched towards the gate then the Qajar forces began to attack. Mustafa Khan rushed to Lotf Ali Khan and on his way, killed one of the latter's commanders, Sultan Ali Khan. Lotf Ali quickly returned from Shiraz to his camp with the rest of his men. Shortly afterwards, the second wave of Qajar Forces, 5,000 men under command of Mohammad Khan and Reza Qoli Khan, camped near Shiraz. Lotf Ali Khan tried to ambush them but failed. Mustafa Khan and his men joined the new forces and in early 1792, they clashed with Lotf Ali Khan's forces around Shiraz, which ended in a decisive victory of the Zand Khan. At this time, the situation in Shiraz was unstable. The city was in a food shortage, and Ebrahim feared his opponents and supporters of Lotf Ali Khan would mount a coup against him. Ebrahim wrote a letter telling Agha Mohammad Khan of the situation. Agha Mohammad Khan set out for Shiraz and settled a few miles away in Abarj. Lotf Ali Khan, who was unable to confront this large army, ambushed them at night and killed a large group of Agha Mohammad Khan's troops. It was thought Agha Mohammad Khan had been defeated but as dawn broke, his defeated armies gathered and soon organized. Lotf Ali Khan, who knew he could not resist, was forced to flee. Agha Mohammad Khan entered the city on July 21, 1792; he visited the hostage family of Lotf Ali and sent them to Tehran. Governor of Fars 
In early 1793, Agha Mohammad Khan informed Ebrahim his army would camp near Shiraz, and all notables and Ebrahim himself should visit his camp. Ebrahim hand no choice but to greet Agha Mohammad Khan when he arrived in Shiraz. Agha Mohammad Khan rewarded his supporters, chief among them being Ebrahim, but also took drastic measures regarding the city's population, especially against those who were not royal to him. On his orders, the Nobles of Shiraz, including Ebrahim, were ordered to surrender their wives and children as hostages. To avenge Karim Khan, Agha Mohommad ordered the exhumation of Karim and his bones to be buried in the stairs to his palace. To prevent a revolt from the city's residents, he ordered the destruction of the Arg. When Agha Mohammad Khan left Fars, Lotf Ali Khan, who had been in Tabas for some time, rushed to Fars. When Ebrahim became aware of this, he informed the agents of Agha Mohammad Khan. Mohammad Hussein Khan, Ebrahim's brother, was assigned to confront Lotf Ali Khan with the aid of Agha Mohammad Khan's army. The battle happened in Darian and ended with Lotf Ali Khan's flight to Bam. In 1794, Ebrahim went to Tehran with his tribal army to join Agha Mohammad Khan and besiege Kerman. In October 1794, Kerman was conquered, Lotf Ali Khan was arrested and, at the instigation of Ebrahim, blinded and executed at the age of 26. Ebrahim's time as Governor ended when in November 1794 when Agha Mohammad Khan returned victorious to Shiraz, where he appointed his heir Baba Khan as the governor. Agha Mohammad Khan ordered a banquet to be held for his victory, in which "the fountains of Shiraz be filled with wine". Grand vizierate

Grand vizierate under Agha Mohammad Khan 

Agha Mohammad appointed Ebrahim as his first and only vazir-e a'zam (grand vizier) and in imitation of the Safavid kings gave him the title of E'temad ol-Dowleh. The same year, Agha Mohammad Khan invaded Azerbaijan to take control of the lands between the Aras and Kura rivers. On Ebrahim's advice, Agha Mohammad Khan divided his army into three when he reached Aras. The army under the command of Ebrahim and his brothers captured Yerevan. Agha Mohammad Khan and his army went to Karabakh and after a long siege came to an agreement in which he was not allowed to enter Shushi but Karabakh became subordinate. in August, Ebrahim joined Agha Mohammad Khan in the conquest of Georgia. In 1795, after the victory in Krtsanisi, Agha Mohammad Khan and his company, including Ebrahim, camped in Mugan plain, where in 1736, Nader Shah, in front of notables of Iran, proclaimed himself king. Ebrahim, who saw an uncrowned king as a motive for claimants, took the opportunity to offer Agha Mohammad Khan a coronation. Until that day, Agha Mohammad Khan had refused to accept the title of Shah, out of respect for Sultan Mohammad Mirza, a claimant member of the Safavid dynasty, who was present in Qajar Khan's camp, and because he had not yet united all of Iran. Ebrahim, in a letter to Shrine of Sheikh Safi al-Din, ordered the sending of the sword of Ismail I to Mughan. Astrologers found Nowruz of 1796 auspicious for the ceremony. On the appointed day, Agha Mohammad Khan wore a silken robe and sat on a marble throne; he wore the diamond Daria-i-Noor, which he had taken from Lotf Ali Khan, and tied the sword of Ismail I around his waist. Ebrahim placed the pearl-adorned crown of Kiani on Agha Mohammad Khan's head and proclaimed him the Shah of Iran. Agha Mohammad Khan then marched to Mashhad to subdue Shahrokh Afshar while Ebrahim went to Tehran. While Agha Mohammad Khan was traveling to Khorasan, a few revolts took place in the realm for vengeance of Lotf Ali Khan; the most important rebellion was led by Yaqub Khan Zand in Shiraz. Yaqub Khan was grandson of Sadeq Khan who survived Sayed Morad Khan's purge. Ebrahim took command of an army and went to Shiraz because he was interested in meeting Yaqub Khan. The rebels were defeated after a quick battle and the Zand pretender was captured. After talking to Yaqub Khan for a while, Ebrahim exiled him to the Ottoman Empire. To prevent further revolts from the Zands, and to organize a central administration in Tehran, Ebrahim recruited former officials who were in Zand service. In the same year, French diplomats Jean-Guillem Brugesire and Guillem Antonin Olivier visited Tehran and met with Ebrahim. Their aim was to persuade Agha Mohammad Khan to abandon his rule over Georgia, and also wanted to establish a link with Europe through Mingrelia. Ebrahim, however, told them Iranian rule over Georgia was legitimate and based on the 1618 Treaty of Serav, during which Shah Abbas I annexed Georgia. Rivalry with Mirza Shafi Mazandarani 

In 1796, while Russians were marching to Georgia and Transcaucasia, Agha Mohammad Khan in Tehran appointed Mirza Shafi Mazandarani as kalantar of Tehran and then left with an army to fight Valerian Zubov. Agha Mohammad Khan appointed him after Mirza Shafi accompanied him in the invasion of Khorasan. In Mashhad, by Mirza Shafi's advice, Shahrokh Shah, the grandson of Nader Shah, was tortured to expose his grandfather's royal jewels. Mirza Shafi did not trust Ebrahim, whom he saw as a traitor to Lotf Ali Khan and believed he would do the same to Agha Mohammad Khan. Mirza Shafi was also ambitious; he sought to discredit Ebrahim with Agha Mohammad Khan so with his removal, he would become the grand vizier. A rivalry arose between the two, in which both sought to persuade Agha Mohammad Khan to dismiss the other. Agha Mohammad Khan established a bureaucratic system all powerful Qajar Grand Viziers would try to replace in later years. Under this system, the rulers of each region would only answer to the king and would ignore Grand Viziers. Ebrahim, who had strengthened his influence in some areas such as Shiraz, had the Crown Prince and Governor of Fars, Baba Khan report anything to him and address him with respect. The situation in Tehran was different since Mirza Shafi did not inform Ebrahim of any issues, including taxes and the internal situation of the city. There was also the issue of dealing with peasants' cases, and complaints and court rulings. Ebrahim dealt with the demands and complaints of the peasants every day, and Mirza Shafi accepted the complaints because he was kalantar of Tehran. To resolve this dispute, Tehran officials divided the city into two parts, leaving one part to the Grand Vizier and the other to the kalantar of Tehran. though neither man accepted the suggestion. Ebrahim knew the Qajar King would not oust Mirza Shafi for the time being so Ebrahim decided to appoint his ally Mirza Mohammad Davalu as a co-kalantar for him. Agha Mohammad Khan immediately accepted the offer because since the murder of his brother Jafar Qolli Khan on his orders, Agha Mohammad Khan's relationship with his tribe had been cold and he needed their support. Empowering one of his relatives would restore the Qajars trust in him. The duties of the municipality were divided between the two kalantars; administrative affairs passed to Mirza Mohammad and responsibility for military defense of the capital passed to Mirza Shafi. In reality, Mirza Mohammad's share and wages went to Ebrahim; Mirza Shafi was dissatisfied with this issue and continued to deal with financial and judicial affairs, and ignored Mirza Mohammad. The dispute between the kalantar of Tehran and the Grand Vizier was growing but neither of them dared to complain to Agha Mohammad Khan, who was at war, so they endured the situation. Assassination of Agha Mohammad Khan 
In 1797, Ebrahim joined Agha Mohammad Khan on a march to Shusha, where Agha Mohammad Khan was assassinated by his servants. The day after, when officials learned of Agha Mohammad Khan's death, Ebrahim ordered the formation of an emergency council, which included Sadeq Khan Shaqaqi, Hussein Qoli Khan (the brother of Baba Khan), Suleiman Khan Qajar Qowanlu, and the governor of Azerbaijan. At this meeting, it was decided Agha Mohammad Khan's death should remain a secret for the time being so the army would not disintegrate and the situation in the realm would not become chaotic. Sadeq Khan forbade entry and exit to the camp, and ordered the army commanders to be careful of the city's gates and to not let anyone who knew about the death leave the city. Ebrahim suspected the assassination plot had been ordered by Sadeq Khan, and now Sadeq Khan had taken control of the city, he might try to kill Ebrahim. Ebrahim gathered a large part of Agha Mohammad Khan's disintegrated army then went to Tehran via Ardabil. Rebellion of Sadeq Khan Shaqaqi 

As soon as Sadeq Khan was informed of Ebrahim's departure to Tehran, he set out to conquer the capital and usurp the throne. Sadeq Khan stopped for two days in Sarab and handed over 2,000 of his troops to his brother Mohammad Ali Sultan, and sent him to conquer Tabriz. Sadeq Khan then continued his attack with 23,000 soldiers, and confronted and defeated Hussein Qoli Khan in Chaharbagh. Sadeq Khan thought Tehran was a defenseless city that would be quickly conquered but when he arrived in Tehran, he realized the city gates were closed and only the muleteers were allowed to enter. Sadeq Khan wrote a letter to Mirza Shafi the kalantar of Tehran, assuring him he would make Mirza Shafi his grand vizier if the city gates were opened. Mirza Shafi objected and replied the city gates would only be opened only to the Crown Prince Baba Khan. Sadeq Khan besieged the city for three days but with supplies lowering, he had to retreat to Qazvin. In Qazvin, he announced this city, which was the capital of Ismail I, would be his capital too, though Qazvin was the capital of Tahmasp I. Sadeq Khan wanted to capture Tehran but his army was in a weak position so he asked his brothers Jafar Qoli Khan, the Governor of Ahar, and Mohammad Ali Sultan, who had conquered Tabriz, to invade the city. At the same time, Ebrahim wrote a letter telling the Crown Prince in Shiraz of the situation, then prepared with his brothers to organize an army to retake the conquered areas. Mirza Shafi, who saw more profit in helping the grand vizier, gave Ebrahim several cannons. Ebrahim did not know Qazvin was under Sadeq Khan's control so in September that year, he set out for Tabriz. Ebrahim defeated Sadeq Khan's brothers in several battles and pushed them back to Zanjan. On September 27, Baba Khan arrived in Tehran with an army of about 30,000 men. Baba Khan wrote a letter to Ebrahim asking him to combine the two armies. The news that Sadeq Khan had camped in Qazvin reached Tehran and Baba Khan's army marched towards the city in October 12. When Sadeq Khan realized Baba Khan's army was moving towards Qazvin, he decided to join his brothers, and left the city with 23,000 soldiers. On October 14, Baba Khan conquered Qazvin without bloodshed, then pursued Sadeq Khan and fought and defeated him in Khakali near Qazvin. Ebrahim defeated the rest of the rebels in Zanjan by the end of October. Sadeq Khan was forgiven and became the ruler of Sarab and Mianeh but Baba Khan kept Sadeq Khan's  wife and daughter-in-law in prison, and ordered their torture. Sadeq Khan once again tried to revolt but was arrested and imprisoned in a room by Ebrahim, who later ordered his execution by stoning. Grand vizierate under Fath-Ali Shah 

When Baba Khan ascended the throne as Fath-Ali Shah, he allowed Ebrahim to remain Grand Vizier. Under his tact and foresight, the early turbulence of the new shah's reign ended quickly. The most important revolt after Sadiq Khan's was that of Fath-Ali Sha's brother Hussein Qoli Khan, governor of Fars. In 1798, Hussein Qoli Khan blinded several officials of Shiraz, including Ebrahim's brother Mohammad Zaman, then set out to conquer Tehran. Hussein Qoli Khan's army fought with Fath-Ali Shah, who was accompanied by Ebrahim, in Saruq; before the battle, Ebrahim sent a courier to Hussein Qoli Khan with false messages concealed in one of his boots, addressed to Hussein Qoli's army chiefs, asking them to leave the governor and joining the Shah. The courier was arrested and the false messages revealed, leading Hussein Qoli to become uncertain of his chief's loyalty, abandoned his revolt, and surrendered to Fath-Ali Shah. After this incident, Fath Ali Shah's trust in Ebrahim increased; Ebrahim used this trust to divert the young king from state affairs and increase his influence. Gradually, Ebrahim appointed his siblings as Governors across the realm and wedded his daughter to Mirza Mohammad-Ali Khan, a respected figure in court, to gain an alliance against his rival Mirza Shafi, who was now leader of the opposition. Around this time, Ebrahim put Mirza Shafi in house arrest and made Mirza Mohammad the sole kalantar of Tehran. During Ebrahim's lifetime, the East India Company began to court cooperation from Iran. In 1799, Zaman Shah Durrani emerged as a threat to the British colony in India; the East India Company sent an ambassador named Mahdi Ali Khan Bahadour to Tehran to urge Fath Ali Shah to invade the Durrani Empire. In Tehran, Mehdi Ali Khan negotiated with Ebrahim, who refused to invade Afghanistan, not wishing to start another conflict following years of civil war and the conquests of Agha Mohammad Khan. The following year, another ambassador, John Malcolm, arrived in Iran, meeting first in Shiraz and then in Tehran. Malcolm asked Ebrahim to protect the Lahore Shiites from the Sunni Afghan tribes but Ebrahim replied the government's political concerns are separate from its religious beliefs. Malcolm persuaded Ebrahim to sign a trade agreement with Britain, which allowed British traders to trade in Iranian ports in the south. Death 
Ebrahim's opponents gradually grew and secretly made a pact with Mirza Shafi, and began plotting against Ebrahim. Their provocations and the growing fear of the power of Ebrahim's family led Fath Ali Shah to decide to oust and kill him. There is a view the British ambassadors were also involved in this conspiracy. Ebrahim was affected by the lack of a strong alliance with the Shah's mother because in the opinion of Fath Ali Shah, Ebrahim was an obstacle to a life of pleasure and prosperity the new shah intended to lead, even though earlier,  Ebrahim pushed the Shah out of internal matters of the realm, and as was later the case with the other Qajar kings, Fath Ali Shah trusted only his mother completely, and if his mother was a supporter of Ebrahim, he would also support him. Ebrahim suspected a conspiracy was being hatched against him, and in March 1801, he told John Malcolm he was worried about his safety. Malcolm tried to make peace between Ebrahim and the opposition, and advised Ebrahim to deal with the shah in a better temper. Ebrahim replied that he could not change his forthright nature and even if he did, it would not deescalate his opponents' hostility towards him. On April 14, 1801, Ebrahim was summoned to the shah and accused of plotting against him. Ebrahim denied all of the charges. After a short time, he was taken to Taleghan, blinded, had his tongue cut out, and killed. On Shah's orders, Ebrahim's family was purged; all of the adult males were arrested and Ebrahim's three brothers—Abdol-Rahim, governor of Isfahan, Mohammad Zaman, the blind kalantar of Shiraz, and Mohammad Hassan the governor of Kohgiluyeh—along with his eldest son Mirza Mohammad were executed. Asadollah, another of his sons, was also blinded. Mirza Ali Reza, one of his young sons, was castrated. Only his youngest son Ali Akbar and his daughter Mahbanu Khanum, survived the purge. Family 

Ebrahim had only one wife, Gulab Khanum, the daughter of Samuel Khan, a famous Jewish merchant of Shiraz. This marriage took place in 1782, when Ebrahim was still the kalantar of Shiraz. They had five children, four boys and a girl:

 Mirza Mohammad Khan, his eldest son and beglerbegi of Fars, who was executed in the 1801 purge. Asadollah Khan (1783-1863), In 1793, although he was still a child, Agha Mohammad Khan took him into his custody, sent him to Qazvin with the intention of taking him hostage. In the early days of Fath Ali Shah, when Asadollah was 16 years old or younger, he became the governor of Kashan for a short time. Asadollah was blinded in the 1801 purge. He died at the age of 83 in Shiraz. Mahbanu Khanum, married with Mirza Mohammad-Ali and gave birth to Mirza Abolhassan Khan Ilchi. Ali Reza; because of his youth, Ali Reza was spared but was castrated, and became a eunuch in the royal harem. Ali Akbar, was also to be castrated but was spared because of his illness, from which he was expected to die. Years later for appeasement, he was given the title Qawam al-Mulk and his family lands in Fars were returned to him. His children formed the Qavam family. Ali Akbar also organized the Khamseh tribal confederacy. The Qavam family remained powerless for a short time after Ebrahim's death but restored their wealth and gained alliances in court that protected them from schemes against them. They were the architects of the modern Shiraz, having built over twenty palace and gardens there, the best-known of them being Qavam House. Religious beliefs 
Qajar historians generally identified Ebrahim as a Jew, although he may have been Muslim. Some historians, such as Mahmud Mahmud, have referred to him as an anús; in the time of Ebrahim, synagogues were opened in Shiraz and Tehran, but before that, Jews had to read the Torah in a low voice in their houses. Another evidence is his desire for monogamism, since at that time, it was customary for high-ranking officials to have several wives and several concubines whereas Ebrahim had only one wife. Ebrahim never drank wine in public and tried to present himself as a religious person. He went to Hajj and preferred people to refer to him as "Hajji". He also had a lot of respect for the mullahs of Shiraz and always paid his zakat. Ebrahim was a supporter of Usuli Mujtahids and was an ally to Agha Mohammad-Ali Behbahani, and thus an enemy of the Ni'matullāhī Sufi order. Historiography and legacy 

Hajji Ebrahim Shirazi is considered a controversial figure in the modern history of Iran; some historians describe him as a "traitor" to Lotf Ali Khan while some admire his genius. Mahmoud Mahmoud praised Ebrahim's tact and called him a "kingmaker". According to Abbas Amanat, Ebrahim is "the least understood statesman of modern Persian history", and Amanat adds John Malcolm's opinion: "Malcolm, who was on intimate terms with him, praised him as a 'truly a great man,' a genius, and one of the best statesmen Persia has ever had". Modern historian Ebrahim Al Davood, however, describes Ebrahim as a politician whose ignorance of world affairs at the time meant he could not exploit conflicts between European governments in favor of Iran, and as one who inflicted heavy losses on the realm's interests. Hossein Ahmadi sees Ebrahim as a politician who, when the country was in crisis, was forced to turn against Lotf Ali Khan to end it. According to Ahmadi, despite Ebrahim's efforts to strengthen his position alongside the Zand and Qajar dynasties, he never gained the trust of powerful circles in a period in which the bureaucracy was weak, and met the same fate of Nizam al-Mulk and Rashid al-Din Hamadani, that would also befall Abol-Qasem Qa'em-Maqam and Amir Kabir. The demonization of Ebrahim partly comes from a heroic portrayal of Lotf Ali Khan as a saviour of Iran who was defeated by the kalantar's deception. Ebrahim's reputation was sullied by Qajar historians who had to portray him negatively to avoid depecting Fath-Ali Shah's punishment of Ebrahim and his family as an injustice. Regarding his action towards Lotf Ali Khan, it is likely that Ebrahim initially aspired to create a confederation of semi-autonomous tribes and Free cities rather than to dethrone Lotf Ali in favour of Agha Mohammad Khan. The plan failed because Ebrahim had to surrender Fars to the Qajars but his wish was later realized by his son Ali Akbar, who formed the Khamseh tribal confederation. Ebrahim had once told John Malcolm that he only turned to the Qajars because it was "desire to save his country from the continual petty wars". Ebrahim was the main figure in ending the war of succession for the throne of Karim Khan. Ebrahim's support for Agha Mohammad Khan stabilized Iran and his support for Fath-Ali Shah strengthened the power of the Qajars. Ebrahim also influenced the later Qajar grand viziers such as Mirza Aqa Khan Nuri, who looked at his administration with admiration. Ebrahim's downfall, which denoted the weakness of the ministers' autonomy toward the authoritarian power of the kings, and along with the death of Qa'em-Maqam and Amir Kabir, became a main concern for early intellectuals of the Iranian Enlightenment, whose wish for freedom of speech eventually resulted in the Constitutional Revolution. 