Working on a tip-off, agents followed the men for two days and monitored e-mails they'd allegedly sent from the northwestern city of Peshawar, two Pakistani intelligence officials told The Associated Press on condition of anonymity.
Agents posing as customers in the Internet cafe swooped on the pair Thursday after one of them, a Yemeni national, sent an e-mail, the officials said. The other man's nationality wasn't revealed.
The officials declined to comment on the content of the e-mails and would only say that they were sent to "terrorists."
One of the two men was identified as Khalid Ahmed; the name of the other was not given. The authorities said the suspects were being questioned at an undisclosed location.
Peshawar is the capital of Pakistan's deeply conservative North West Frontier Province, where an Islamic coalition that supports Afghanistan's Taliban militia is in power.
The arrests came less than a week after police captured the younger brother of Hambali, al Qaeda's alleged top agent in Southeast Asia. Rusman Gunawan, an Indonesian, was arrested in the southern port city of Karachi on Saturday with 16 Islamic students from Malaysia, Indonesia and Myanmar.
Pakistani intelligence officials have said they believe Gunawan, 27, was running the Pakistani branch of the Jemaah Islamiyah terror group, blamed for last October's Bali bombings that killed 202 people.
The arrests have highlighted a suspected network of links between al Qaeda and Jemaah Islamiyah.
Many alleged Jemaah Islamiyah leaders, including Hambali, are believed to have trained at al Qaeda camps in Afghanistan, and dozens of Indonesian Islamic students are believed to be in the region.
The city of Peshawar, where Thursday's arrests were made, is about 30 miles from the Afghan border.
Pakistan has been a key U.S. ally in the war on terror and its security agencies have arrested more than 450 suspected al Qaeda agents.
Among them was Khalid Shaikh Mohammed, the alleged mastermind of the Sept. 11, 2001, attacks, who was captured near the capital in March. Mohammed was handed over to the United States and is being held at an undisclosed location outside Pakistan.
In the southern Pakistan city of Karachi, police said they arrested three suspected members of a separate outlawed Islamic militant group who were allegedly plotting a terrorist attack against an unspecified target. They said they seized six homemade bombs and three pistols.
The men — alleged members of Lashkar-e-Jhangvi, an organization of extremist Sunni Muslims — were arrested late Thursday at a home, said deputy superintendent of police Amjad Kiyani.
Lashkar-e-Jhangvi was banned in 2001 by President Gen. Pervez Musharraf in a move aimed at eliminating Islamic extremism from Pakistan.
The group is suspected of killing hundreds of minority Shiite Muslims. In recent months, it has been blamed for attacks targeting Christians and Westerners in Pakistan.
Islamic militant groups were angered by Musharraf's support for the U.S.-led war against the Taliban in neighboring Afghanistan. Pakistan-based Islamic militant groups were linked with the Taliban and many trained their fighters in Afghanistan before the militia was ousted in late 2001.
By Riaz Khan