Army spokesman Major General Asif Ghafoor's remarks came during a press briefing about security threats to Pakistan.
Ghafoor said Pakistan faced different kinds of challenges on the eastern and western borders due to different nature of threat and the critical question was "whether the threat is because of a state or non-state actors".
"Threats from India (in the east) are perpetual. We are a peaceful country and we do not want war with them, but we will defend ourselves and have the capability to do so," he said.
He said the country's eastern border had become "unsafe" due to repeated violations at the Line of Control, which he claimed are the highest than any year before.
"India has also paid a price due to our response (on LoC) and we will continue to do so if it does not act with restraint," Ghafoor said.
He said Pakistan cannot fire indiscriminately across the LoC as there are Kashmiri brothers on the other side as well.
"So when there are casualties on that side, it is Indian soldiers and infrastructure. Nonetheless, war is not a solution, so we are talking to them [Indian officials] at all levels to stop this (LoC violations]," he said.
He accused India of supporting militants.
He highlighted the "strategic threat" on the western border with Afghanistan which kept the Army busy due to the threat of Tehreek-i-Taliban Pakistan militants and other non- state actors.
"The western border touches both Afghanistan and Iran and our deployment is not against these countries but against non-state actors, he said.
He said Pakistan has eliminated militants' stronghold and there was not "organised bases of any terrorist organisation in the country".
He also said that unlike Pakistan more than 50 per cent of Afghanistan under control of rebels including who are targeting Pakistan.
To a question about detained JuD chief Hafiz Saeed-backed Milli Muslim League party taking part in elections, he said that "every Pakistani has the right to participate in the polling process".
He defended the role of the Army to work in aid of civil institutions but ruled out any possibility of direct intervention in political affairs.
"Martial law should not even be talked about. We are busy in doing our duty as stated in the Constitution," he said.
Ghafoor said the visit of army chief General Qamar Javed Bajwa to Afghanistan on Sunday was successful.
He said Pakistan hoped that with the improvement in the coordination, trust between the two countries would increase.
To a question, he said that 12,000 Indians visited Pakistan to attend a congregation of Bohra community in Karachi last month.