Ordinarily what you mentioned above should be the major functions of army including maintaining of the internal security of the country, protecting the territorial boundaries/borders of the Nation, and contributing to other cross-border security activities such as regional and international peacekeeping operations.
In the army, there is also a clear-cut compactmentalization of activities and departments so there are some departments that work with intelligence operations and some that are on-field operations and as a nation you're supposed to deploy everyone to its own department by training so there will be shared responsibility amongst all the forces but in my own country reverse is the case it's like a jungle kind of arrangement where everybody just do things scatteredly.
It is this lack of coordination and lack of proper devolution and delegation of power within the military system that have caused the over stretched military force that we have today in this part of the world.
You find situations whereby militaries are interfering with some of the domestic duties of the police and other paramilitaries because of the lack of coordination. This is not because the nation lacks military forces in terms of Manpower but because there is no proper coordination of the system and more importantly there are no much effort placed on armoury and equipments in the army over here.