During the hours that Omar Mateen was rampaging through an Orlando gay nightclub, he paused to post to Facebook declarations of loyalty to the Islamic State and threats of more attacks “in the next few days,” according to a key senator on Homeland Security issues.

“I pledge my alliance to (ISIS leader) abu bakr al Baghdadi..may Allah accept me,” Mateen wrote in one post early Sunday morning, Fox News reported.

Mateen went on to protest U.S. foreign policy and “the filthy ways of the west” before saying — he didn’t elaborate on how he knew this — Islamic State sympathizers would commit more attacks.

“You kill innocent women and children by doing us airstrikes … now taste the Islamic state vengeance,” he wrote on Facebook. “America and Russia stop bombing the Islamic state … In the next few days you will see attacks from the Islamic state in the usa.”

The Facebook posts were revealed to Fox News by Sen. Ron Johnson, Wisconsin Republican and chairman of the Homeland Security Committee.

“It is my understanding that Omar Mateen used Facebook before and during the attack to search for and post terrorism-related content,” Mr. Johnson wrote in a letter to Facebook obtained by Fox News. “According to information obtained by my staff, five Facebook accounts were apparently associated with Omar Mateen.”

The accounts were taken down before Mateen’s name became widely known as the perpetrator of the attack on the Pulse nightclub that killed 49 people and wounded more than 50 others. But Mr. Johnson’s staff was able to obtain some of their content, Fox reported.

Mateen accessed his Facebook accounts “to search for media reports, using search words such as ‘Pulse Orlando’ and ‘Shooting.’ An FBI source told FoxNews.com he also made 16 phone calls from inside the club after the bloody spree began,” Fox News wrote. Some of those calls already have been reported on individually, and were consistent with Mr. Johnson’s claims, such as pledging allegiance to the Islamic State and claiming he was committing the terror attack on its behalf.

In his letter to Facebook, Mr. Johnson asked the social-media giant to brief his panel and hand over all the information it has on Mateen and his online activity by June 29.