The Triarii (Latin singular triarius) was the third standard line of infantry of the Roman Republic's army. Its name is related to the Latin word tres ("three"), ultimately derived from Proto-Indo-European *trei-. When suffering defeat, the first and second lines, the Hastati and Principes, fell back on the Triarii to attempt to reform the line and allow for a counter attack or withdrawal of the other lines. Because falling back on the Triarii was an act of desperation, to mention "falling on the Triarii" ("ad triarios rediisse") became a common Roman phrase indicating one to be in a desperate situation. To be the officer of the triarii was an honor. It made one one of the best men in the legion. One's pay would be superior to the other middle-class officers and one would be given a horse for the long marches, which was quite important.
Triarii were sometimes, not unlike the Principes, divided into ten maniples of 160 men. Each maniple consisted of two centuries consisting of 80 men each, commanded by a centurion. In other cases they were in fact divided into ten maniples of only 120 men, the size of a century of Hastati or Principes. Hence in many battles the Triarii numbered only half as many as the Hastati or the Principes. The Triarii were the veterans of the Roman army, making them perfectly suited for reinforcing the two front lines of the formation. They were armored much like the rest of the Roman Republican army, with whatever they could afford (typically more than the poorer Hastati and Principes).
When the Principes and Hastati of Republican army were rearmed with javelins, the Triarii retained their long spears and scuta and continued to fight as a phalanx. If the initial attacks of the javelin- and sword- armed troops could not break an enemy, the Triarii served as a strong point around which the army would regroup (in the same manner as in much later centuries squares of musketmen were to provide a defensive screen for reforming cavalrymen). They also were responsible for holding off cavalry charges with their spears.
Sometimes the Triarii were not deployed on the battlefield at all, but were left to guard the camp.The troops left behind to guard camp during the battle of Cannae were most probably the Triarii, and it has been speculated that had the Triarii been deployed on the battlefield that day the Roman army could have better dealt with Hannibal's cavalry.
The term Triarii, together with the terms Principes and Hastati, survived into Imperial times, each denoting a third part of a cohort. However, by this time these names were merely honorific, the cohort being uniformly armed and equipped.