Of course, if an enemy attacks the Muslims then by the standards of wits, common sense, and religious law, self defense which as a form of Jihad/Jehad becomes essential and indispensable.
All the battles of the Prophet Mohammad (pbuh) in which Imam Ali ibn Abu Talib (AS) fought armed and truthfully were defensive battles.
Imam Ali ibn Abu Talib (AS) was such a brave, faithful, holy warrior who never got frustrated and upset and tired of the fighting and battles. He was afraid of no one except God. He used to say "By God if I see that on one side is the truth and on the other side all the rest of the people I, without caring and paying heed to those reproaching me, will fight all alone with my sword, on the way and path of the right, against them.