Two times against Algeria and against POLISARIO rebels (who where in fact made up by Algeria so basically we fought against Algeria and other mercenaries: Cubans, Soviets etc.)

"Narrated ibn Mas'ood (may Allah be pleased wit him): Allah's
Messenger(pbuh) said, "ruined are those who insist on hardship in matters of faith." He repeated this 3 times!."

[Saheeh Muslim]