Ahimsa Paramo Dharmah, Dharma himsa tathaiva cha – Sloka does NOT exist !

अहिंसा परमो धर्मः धर्म हिंसा तथैव च: (Ahimsa Paramo Dharmah – Dharma himsa tathaiva cha) is not a sloka from any religious scripture. Also anyone with good knowledge in sanskrit grammar can sense that 2nd line is semantically not sound.
The first line is widely used even by M.K.Gandhi to quote that ‘Non-Violence is highest duty‘ but it is only half-sloka.
Ahimsa Paramo Dharmah

Unlike the English word ‘non-violence’ which is in absolute sense, ahimsa means ‘non-violence’ in a relative sense.
The सूक्ति (sookti) — अहिंसा परमो धर्मः (Ahimsa parmo dharmah) is itself from Mahabharata.
This phrase appears multiple times in different parvas (episodes) of Mahabharata and each line is told with different conclusive phrases in different situations.
In all its occurances, this preaching about non-violence (ahimsa) is done to brahmin/sanyasi/rishi who is abstained from weapons and has taken up ascetic lifestyle to attain self-realisation (brahman).
To apply this sookti for kings, warriors whose duty to protect dharma and kingdom is wrong !
Also it does not apply to a common man whose duty is to protect his family and society around him.
In Adi Parva – Suta Muni is telling the story of a serpent who transforms itself into Brahmin named Sahasrapat and utters this verse to a Brahmin named Ruru who used to kill snakes because his wife was bitten by one.

Ruru Sahasrapaat

अहिंसा परमो धर्मः सर्वप्राणभृतां स्मृतः ।
तस्मात्प्राणभृतः सर्वान्न हिंस्याद्ब्राह्मणः क्वचित् ।। (1.11.12) [ 1st (Aadi) Parva, 11th chapter, 12th sloka]

Translation : Certainly non-violence is the highest virtue is sparing the life of others. Therefore a Brahmana should never take the life of any creature.

In Vana Parva – Markandeya Muni is narrating the discussion between a brahmana named Kausika and a poultry-monger named Dharmavyadha who lived in Mithila. The Kausika asks the fowler ‘How shall I know what is virtuous conduct.’ Dharmavyadha answers as :

Dharmavyadha Kaushika

अहिंसा सत्यवचनं सर्वभूतहितं परम
अहिंसा परमॊ धर्मः स च सत्ये परतिष्ठितः
सत्ये कृत्वा परतिष्ठां तु परवर्तन्ते परवृत्तयः ।। (3.198.69)

Translation : Among holy men, virtue is differentiated in three ways — that great virtue which is inculcated in the Vedas, the other which is inculcated in the dharma shastra, and virtuous conduct And virtuous conduct is indicated by acquisition of knowledge, pilgrimage to sacred places, truthfulness, forbearance, purity and straight-forwardness.

In Anushasana Parva – Yudhisthir is getting final anushsana (instructions) from Bhishma who is on a bed of arrows, Yudhisthir asks Bhishma –

अहिंसा परमॊ धर्म इत्य उक्तं बहुशस तवया ।
शराथ्धेषु च भवान आह पितॄन आमिष काङ्क्षिणः ।। (13.116.1)

Translation : You have told it many times that abstention from injury is the highest religion. In Sraddhas, however, that are performed in honour of the Pitris, persons for their own good should make offerings of diverse kinds of meat.

Bheeshma with Yudhishtira

Bhishma goes on to explain these issues in a great detail and in two of those verses it is mentioned again.

अहिंसा परमॊ धर्मस्तथाहिंसा परॊ दमः।
अहिंसा परमं दानमहिंसा परमं तपः ।।
अहिंसा परमॊ यज्ञस तथाहिस्मा परं बलम
अहिंसा परमं मित्रम अहिंसा परमं सुखम
अहिंसा परमं सत्यम अहिंसा परमं शरुतम ।। (13.117.37,38)

Translations : Ahimsa is the highest Dharma, Ahimsa is the highest self-control,
Ahimsa is the greatest gift, Ahimsa is the best practice,
Ahimsa is the highest sacrifice, Ahimsa is the finest strength,
Ahimsa is the greatest friend, Ahimsa is the greatest happiness,
Ahimsa is the highest truth, and Ahimsa is the greatest teaching.

Ahimsa Paramo Dharmah – Dharma himsa tathaiva cha is coined very recently and not from any veda, upanishad, purana or itihasa.
But both Ramayana and Mahabharata have multiple slokas that talk about the circumstances which justify war and self-defense. In the Anushasan Parva it is Bhishma, the foremost warrior of his time, who is talking about Ahimsa because he only fought when his duty demanded.
Ahimsa is also not initiating violence first and is actually self-defense.

One of the definitions of Ahimsa —

वेदोक्तेन प्रकारेण विना सत्यं तपोधन ।
कायेन मनसा वाचा हिंसाऽहिंसा न चान्यथा ॥
आत्मा सर्वगतोऽच्छेद्यो न ग्राह्य इति मे मतिः ।
स चाहिंसा वरा प्रोक्ता मुने वेदान्तवेदिभिः ॥ ( 1.7,8 दर्शनोपनिषत्) Darshan Upanishad or Jabal Darshan Upanishad or Yog Darshan Upanishad of Samveda.

Translation : Indeed, the non-indulgence in violence by body, mind or word of mouth, in accord with Vedic injunctions are non-violence: not otherwise. O sage! the firm belief that the Atman pervades all, and it is indivisible and inaccessible to the senses. This belief is said to be the best basis of non-violence by those who know Vedanta.
Ahimsa Nonviolence
Here, ahmisa is in the context of describing the basic ethics (Yama) of a Yogi. It does not apply to a king, soldier, businessman, farmer etc.
A businessman cannot sit an watch a thief stealing from his shop and say ‘Ahimsa paramo dharmah‘. Similarly if a farmer thinks the same, he cannot save his crop from pests.
Kings were weakened by Buddhist and Jain monks by these unnecessary ‘ahimsa‘ practices and India was conquered by invaders.
If a king fails in the discharge of his duty and if he does not punish the wicked, his country will be in a state of utter chaos.
To hang a murderer is Ahimsa for a king. To kill a man who is taking away the lives of many is Ahimsa.
A real Sannyasin, however, should not defend himself even when his life is in danger. A Sannyasin is one who does not associate with his body, instead identifying himself with the Atman.

Ahimsa paramo dharmah” is not mentioned in the Bhagavad Gita.
The word Ahimsa is mentioned four times in the Gita.
When Arjuna tells Krishna that he is despondent and unwilling to fight the war, Lord Krishna repeatedly tells Arjuna to get up and fight.

Krishna Arjuna Gita

अथ चेत्त्वमिमं धर्म्यं संग्रामं न करिष्यसि
ततः स्वधर्मं कीर्तिं च हित्वा पापमवाप्स्यसि [Gita 1.20]

Translation : If, however, you do not fight this dharmic war, then you will certainly incur sins for neglecting your duties and thus lose your reputation as a fighter.

If Krishna said ‘Ahimsa paramo dharma‘ then the war would have ended before it began because he would have effectively been stating that there is no need to fight because the greater dharma is non-violence and Pandavas should forgive every atrocity done on them by Kauravas.
Ahimsa Paramo Dharmah” can only be practiced by Sanyasis who tread the path of Nivritti Marga. It cannot be strictly practiced by householders.
Duty of police is to punish criminals and extract information from them even if it had to by means of physical violence.
Even Law has declared that a murder done in self defense is not crime.
Ahimsa Paramo Dharmah Sculpture

Krishna himself declared that

परित्राणाय साधूनां विनाशाय च दुष्कृताम्
धर्मसंस्थापनार्थाय सम्भवामि युगे युगे |

Translation : To deliver the pious and to annihilate the miscreants, as well as to reestablish the principles of religion, I Myself appear, millennium after millennium.

He clearly states that ahimsa, while highly regarded, is not the highest dharma for everyone and certainly not for warriors like Arjuna or himself on the battlefield of Kurukshetra.