CAIRO — Days after Sudanese soldiers massacred pro-democracy demonstrators in Khartoum in June, an obscure digital marketing company in Cairo began deploying keyboard warriors to a second front: a covert operation to praise Sudan’s military on social media.

The Egyptian company, run by a former military officer and self-described expert on “internet warfare,” paid new recruits $180 a month to write pro-military messages using fake accounts on Facebook, Twitter, Instagram and Telegram. Instructors provided hashtags and talking points.

Since the ouster of President Omar Hassan al-Bashir in April, new employees were told, protesters had sown chaos in Sudan. Their demands for democracy were premature and dangerous. Order had to be restored.

“We’re at war,” an instructor told the new employees. “Security is weak. The army has to rule for now.”