Today in modern warfare explosions, tanks, missiles etc are used. The mujahideen and Muslim countries use these weapons against the enemies of Allah. But the Messenger of Allah (peace and blessings be upon him) said, ‘no one punishes with fire except the Lord of the fire.’ Is using these weapons haram?

Praise
be to Allah

Firstly:

If the Muslims gain power over their enemy and defeat them,
it is not permissible to burn them with fire, and there is no difference of
scholarly opinion concerning this matter, because of the proven report from
Abu Hurayrah (may Allah be pleased with him), according to which he said:
The Messenger of Allah (blessings and peace of Allah be upon him) sent us on
a campaign and said: “If you find So and so, and So and so, then burn them
with fire.” Then the Messenger of Allah (blessings and peace of Allah be
upon him) said, when we wanted to set out: “I had instructed you to burn So
and so, and So and so. But no one punishes with fire except Allah, so if you
find them, then execute them.” Narrated by al-Bukhari (3016).

This applies so long as burning does not come under the
heading of requiting and punishing like with like.

But in the event of combat when the enemy is holed up in
fortifications and the like, then the Muslims may raid them and attack them
with fire, and burn their fortifications around them, and do anything that
may undermine their enemy and break their spirit. This was done by the
Sahabah (may Allah be pleased with them), the Tabi‘een and those who came
after them.

That is not included in the prohibition on punishing with
fire, because the hadith was speaking about people who were not holed up in
fortifications. But if they are holed up in fortifications, then there is
nothing wrong with sending fire against them, so as to bring about their
defeat and surrender, whether by means of fire or any other means.

Ibn Hajar said, commenting on a chapter title included by al-Bukhari,
Do not punish with the punishment of Allah:

This applies when burning is not needed as a means to
overcome the disbelievers in a war situation.

End quote from Fath al-Bari (6/149).

It was narrated that Salamah ibn al-Akwa‘ said: We travelled
by sea at the time of Mu‘awiyah (may Allah be pleased with him) and we met
the enemy in battle and launched burning material at them.

Thus we learn that there is nothing wrong with any of that so
long as they are holed up in fortifications. It is only forbidden to burn
with fire after taking prisoners, according to what was narrated from Ibn
‘Abbas (may Allah be pleased with him), that the Prophet (blessings and
peace of Allah be upon him) sent out a group on a campaign and said to them:
“If you capture So and so, then burn him with fire.” (That person) had
spooked the camel of Zaynab (may Allah be pleased with her), the daughter of
the Messenger of Allah (blessings and peace of Allah be upon him), by poking
it, which caused her to fall and suffer a miscarriage. Then he said: “If you
capture him, then execute him and do not burn him, for only Allah, may He be
exalted, punishes with fire.

When the Messenger of Allah (blessings and peace of Allah be
upon him) sent Mu‘adh ibn Jabal (may Allah be pleased with him) to Yemen,
he said to him: “Look for So and so, and if Allah enables you to capture
him, burn him with fire.” But when he turned to leave, he called him back
and said: “I said that to you when I was angry. But no one has the right to
punish anyone with the punishment of Allah, may He be exalted (i.e., fire).
Rather if Allah enables you to capture him, then execute him.” Thus we know
that it was forbidden to burn the mushrikeen after capturing them. But if
the enemy is holed up in fortifications, there is nothing wrong with that. 
End quote.

Ibn Qudamah said in al-Mughni:

As for the enemy, if one is able to gain power over him, it
is not permissible to burn him with fire, and there is no scholarly
difference concerning that as far as we know.

As for attacking them with fire before capturing them, if it
is possible to capture them without resorting to that, it is not permissible
to attack them with fire, because they come under the same heading as those
who are defeated and captured. But if it is not possible to defeat them by
any other means, then it is permissible, according to most of the scholars…

‘Abdullah ibn Qays said: The Muslims are still following this
view. End quote.

Ash-Shafi‘i (may Allah have mercy on him) said in al-Umm
(4/258):

If the enemy is holed up in a mountain, fortress, ditch, or
the like, then there is nothing wrong with attacking them with mangonels,
catapults and fire…

If someone were to ask: How can it be permissible to launch
an attack with mangonels and fire against a group of mushrikeen among whom
are women and children, whom we are forbidden to kill?

The answer is: We allow that in the circumstances we
described. The Prophet (blessings and peace of Allah be upon him) launched a
raid against Banu al-Mustaliq when they were off their guard, and ordered
the fighters to attack them at night with fire, and it was known that among
them were children and women. That was because that was the land of shirk
and was not under protection; rather what is prohibited is to deliberately
target and kill women and children. End quote.

It says in al-Mawsoo‘ah al-Fiqhiyyah al-Kuwaitiyyah
(12/244):

It is prescribed to attack the enemy with fire, even if that
will result in making them suffer its burning. This applies when it is not
possible to defeat them without burning, because the Sahabah and Tabi‘een
did that during their campaigns. As for punishing them with fire after
having defeated them, that is not permissible, because of the report
narrated by Hamzah al-Aslami (may Allah be pleased with him), according to
which the Messenger of Allah (blessings and peace of Allah be upon him)
appointed him in charge of a campaign and said to him: “If you find So and
so, then burn him with fire.” I [Hamzah al-Aslami] turned to leave, then he
called me, so I went back to him and he said: “If you find So and so, then
execute him, and do not burn him, for no one punishes with fire except the
Lord of fire.” End quote.

This has to do the basic principle concerning this matter,
when attacking with fire is not the main method of war. But in the modern
era, the Muslims are required to fight their enemies in the same manner as
they fight them, or even with something better than that if they are able to
do so. And they must develop these weapons and surpass their enemies in
doing so, for this comes under the heading of necessary strength that the
Muslims are commanded to prepare in order to confront their enemies. Allah,
may He be exalted, says (interpretation of the meaning):


“And prepare against them whatever you are able of power and of steeds of war by which you may terrify the enemy of Allah and your enemy”


[al-Anfal 8:60]
.

Ash-Shaykh as-Sa‘di said:

This includes all kinds of skills that are required to
produce various kinds of weapons and equipment such as artillery, automatic
weapons, rifles, warplanes, land vehicles, ships, forts and strongholds,
trenches and defensive equipment, as well as wisdom and diplomacy, by means
of which the Muslims may become advanced in these fields and ward off the
evil of their enemies.

End quote from his Tafseer (p. 324).

Secondly:

Attacking the enemy with modern weapons is of various types:

Some of these weapons cause burning. They come under the
ruling mentioned above, that is discussed in detail. They are more akin to
mangonels and other weapons that involve burning, that are discussed above,
so it is permissible to use them in the case of fighting the enemy or when
the enemy is holed up in fortifications and the like. 

Ss-San‘ani said: It is permissible to kill combatant
disbelievers if they are holed up in fortifications, using mangonels and, by
analogy, by using other weapons such as artillery and the like.

End quote from Subul as-Salam (2/478).

Some of the weapons do not cause burning, such as rifles and
revolvers. Even though the bullets in them are launched by the power of
fire, killing results from the penetration of bullets which pass through the
body. So there is no problem with them using such weapons in their fight,
and the Muslims have been using such weapons for a long time without any
objections.

And Allah knows best.