The crusader Kingdom of Jerusalem was always desperately short of defenders, and constantly in danger of falling to the Muslims. The Templars quickly became important in the defense of the kingdom, as did their sister order, the Knights Hospitaller. They were so respected, and so feared, by Muslim leaders for their dedication and determination, that Muslims commonly murdered them when they captured them, rather than allowing the Templars to be ransomed. This was done, for example, by Saladin after the Battle of Hattin in 1187.
The Templars fought very hard to defend the Holy Land and the Kingdom of Jerusalem that ruled it, but it was a losing battle. There were too many Muslims, and the Christians were constantly outnumbered and on the defensive. At last, in 1291, Muslims drove Christians out of the Holy Land for the second time (the first was in the 7th century), and many Templars, including their Grand Master, were killed in the final siege.
The defense of the Latin Kingdom of Jerusalem, and the blooming of the spirit of chivalry were the determinant causes that induced the "frates" to become "equites et servientes armigeri". By the will of Innocent III, the initial hospitaller tasks were supplemented with military functions. It was an original fusion: military forces defending the Christian dominions, and hospitaller charity defending life.
Initially the group cared for pilgrims in Jerusalem, but the order soon extended to providing pilgrims with an armed escort, which soon grew into a substantial force.