The Armatoloi (Αρματωλοί in Greek meaning "Armed People" not to be confused with αμαρτωλοί - sinners) were local Greek villagers that functioned as military/police units governing Byzantine lands. They were given weapons by the Ottomans in order to repel Greek brigands known as the Klephts.
The history of the Armatoloi does not begin in Ottoman times. In fact, the entire military/police organization of the Armatoloi was known as Armatolismos (Αρματωλισμος in Greek). The organization itself was based off feudalism under which military/police units maintained their duties in exchange for titles of land. When the Ottomans conquered the plains of Greece (along with a myriad of islands), they made treaties with the local Armatoloi and allowed them to continue with their military/police functions.
Many remnants of Greek Byzantine forces became klephts as they migrated into the mountains and resisted the Ottomans. The Ottomans would mobilize the Armatoloi in order to repel the Klephts, as well as protect mountain passes and maintain order in their territories. However, the Armatoloi considered the Klephts as their brothers and both groups supported each other throughout Ottoman times and during the Greek Revolution. As a result of this support, it was quite difficult for the Ottomans to distinguish between both groups and the terms Armatoloi and Klephts were indiscriminate.