Al-Ikhshid reacted, and sent an army north under Abu al-Misk Kafur to confront Sayf al-Dawla, who was besieging Homs.
In the ensuing battle, the Hamdanid scored a crushing victory.
Homs then opened its gates, and Sayf al-Dawla set his sights on Damascus.
Sayf al-Dawla briefly occupied the city in early 945, but was forced to abandon it in the face of the citizens' hostility.
In April 945 al-Ikhshid himself led an army into Syria, although at the same time he also offered terms to Sayf al-Dawla, proposing to accept Hamdanid control over northern Syria and the Thughur.
Sayf al-Dawla rejected al-Ikhshid's proposals, but was defeated in battle in May/June and forced to retreat to Raqqa.
The Egyptian army proceeded to raid the environs of Aleppo.
Nevertheless, in October the two sides came to an agreement, broadly on the lines of al-Ikhshid's earlier proposal: the Egyptian ruler acknowledged Hamdanid control over northern Syria, and even consented to sending an annual tribute in exchange for Sayf al-Dawla's renunciation of all claims on Damascus.
The pact was sealed by Sayf al-Dawla's marriage to a niece of al-Ikhshid, and Sayf al-Dawla's new domain received the—purely formal—sanction by the Caliph, who also re-affirmed his laqab, soon thereafter.

The truce with al-Ikhshid lasted until the latter's death in July 946 at Damascus.
Sayf al-Dawla immediately marched south, took Damascus, and then proceeded to Palestine.
There he was confronted once again by Kafur, who defeated the Hamdanid prince in a battle fought in December.
Sayf al-Dawla then retreated to Damascus, and from there to Homs.
There he gathered his forces, including large Arab tribal contingents, and in spring of 947, he attempted to recover Damascus.
He was again defeated in battle, however, and in its aftermath the Ikhshidids even occupied Aleppo in July.
Kafur, the de facto Ikhshidid leader after al-Ikhshid's death, did not press his advantage, but instead began negotiations.
For the Ikhshidids, the maintenance of Aleppo was less important than southern Syria with Damascus, which was Egypt's eastern bulwark.
As long as their control over this region was not threatened, the Egyptians were more than willing to allow the existence of a Hamdanid state in the north.
Furthermore, the Ikhshidids realized that they would have difficulty in asserting and maintaining control over northern Syria and Cilicia, which were traditionally oriented more towards the Jazira and Iraq.
Not only would Egypt, threatened by this time by the Fatimids in the west, be spared the cost of maintaining a large army in these distant lands, but the Hamdanid emirate would also fulfil the useful role of a buffer state against incursions both from Iraq and also from Byzantium.
The agreement of 945 was reiterated, with the difference that the Ikhshidids ceased paying tribute for Damascus.
The frontier thus established, between Jaziran-influenced northern Syria and the Egyptian-controlled southern part of the country, was to last until the Mamluks seized the entire country in 1260.

Sayf al-Dawla, who returned to Aleppo in autumn, was now master of an extensive realm: the north Syrian provinces (jund Hims, jund Qinnasrin and the jund al-'Awasim) in a line running south of Homs to the coast near Tartus, and most of Diyar Bakr and Diyar Mudar in the western Jazira.
He also exercised a—mostly nominal—suzerainty over the towns of the Byzantine frontier in Cilicia.
Sayf al-Dawla's domain was a "Syro-Mesopotamian state", in the expression of the Orientalist Marius Canard, and extensive enough to require two capitals: alongside Aleppo, which became Sayf al-Dawla's main residence, Mayyafariqin was selected as the capital for the Jaziran provinces.
The latter were held ostensibly in charge of his elder brother Nasir al-Dawla, but in reality, the size and political importance of Sayf al-Dawla's emirate allowed him to effectively throw off the tutelage of Nasir al-Dawla.
Although Sayf al-Dawla continued to show his elder brother due deference, henceforth, the balance of power between the two would be reversed.
Al-Ikhshid reacted, and sent an army north under Abu al-Misk Kafur to confront Sayf al-Dawla, who was besieging Homs. In the ensuing battle, the Hamdanid scored a crushing victory. Homs then opened its gates, and Sayf al-Dawla set his sights on Damascus. Sayf al-Dawla briefly occupied the city in early 945, but was forced to abandon it in the face of the citizens' hostility. In April 945 al-Ikhshid himself led an army into Syria, although at the same time he also offered terms to Sayf al-Dawla, proposing to accept Hamdanid control over northern Syria and the Thughur. Sayf al-Dawla rejected al-Ikhshid's proposals, but was defeated in battle in May/June and forced to retreat to Raqqa. The Egyptian army proceeded to raid the environs of Aleppo. Nevertheless, in October the two sides came to an agreement, broadly on the lines of al-Ikhshid's earlier proposal: the Egyptian ruler acknowledged Hamdanid control over northern Syria, and even consented to sending an annual tribute in exchange for Sayf al-Dawla's renunciation of all claims on Damascus. The pact was sealed by Sayf al-Dawla's marriage to a niece of al-Ikhshid, and Sayf al-Dawla's new domain received the—purely formal—sanction by the Caliph, who also re-affirmed his laqab, soon thereafter.
The truce with al-Ikhshid lasted until the latter's death in July 946 at Damascus. Sayf al-Dawla immediately marched south, took Damascus, and then proceeded to Palestine. There he was confronted once again by Kafur, who defeated the Hamdanid prince in a battle fought in December. Sayf al-Dawla then retreated to Damascus, and from there to Homs. There he gathered his forces, including large Arab tribal contingents, and in spring of 947, he attempted to recover Damascus. He was again defeated in battle, however, and in its aftermath the Ikhshidids even occupied Aleppo in July. Kafur, the de facto Ikhshidid leader after al-Ikhshid's death, did not press his advantage, but instead began negotiations. For the Ikhshidids, the maintenance of Aleppo was less important than southern Syria with Damascus, which was Egypt's eastern bulwark. As long as their control over this region was not threatened, the Egyptians were more than willing to allow the existence of a Hamdanid state in the north. Furthermore, the Ikhshidids realized that they would have difficulty in asserting and maintaining control over northern Syria and Cilicia, which were traditionally oriented more towards the Jazira and Iraq. Not only would Egypt, threatened by this time by the Fatimids in the west, be spared the cost of maintaining a large army in these distant lands, but the Hamdanid emirate would also fulfil the useful role of a buffer state against incursions both from Iraq and also from Byzantium. The agreement of 945 was reiterated, with the difference that the Ikhshidids ceased paying tribute for Damascus. The frontier thus established, between Jaziran-influenced northern Syria and the Egyptian-controlled southern part of the country, was to last until the Mamluks seized the entire country in 1260.
Sayf al-Dawla, who returned to Aleppo in autumn, was now master of an extensive realm: the north Syrian provinces (jund Hims, jund Qinnasrin and the jund al-'Awasim) in a line running south of Homs to the coast near Tartus, and most of Diyar Bakr and Diyar Mudar in the western Jazira. He also exercised a—mostly nominal—suzerainty over the towns of the Byzantine frontier in Cilicia. Sayf al-Dawla's domain was a "Syro-Mesopotamian state", in the expression of the Orientalist Marius Canard, and extensive enough to require two capitals: alongside Aleppo, which became Sayf al-Dawla's main residence, Mayyafariqin was selected as the capital for the Jaziran provinces. The latter were held ostensibly in charge of his elder brother Nasir al-Dawla, but in reality, the size and political importance of Sayf al-Dawla's emirate allowed him to effectively throw off the tutelage of Nasir al-Dawla. Although Sayf al-Dawla continued to show his elder brother due deference, henceforth, the balance of power between the two would be reversed.
Sayf al-Dawla