In a tweet the US embassy in Nairobi said an American and a Canadian had been detained yesterday. "They're safe & departing Kenya," it added.
James Orengo, a senior official in the National Super Alliance (NASA) opposition coalition, named the two as John Aristotle Phillips, an American, and Andreas Katsouris, a Canadian.
Phillips is chief executive officer of Aristotle Inc, a Washington-based data mining firm and political consultancy, while Katsouris is a senior vice president in the company.
"We have for years worked on pro-democracy campaigns. They were helping NASA's candidate," Raila Odinga, Travis said.
More From This Section
Orengo described the two men as "friends from Canada and the United States".
"Both of them were sharing their experiences with us," he said without providing further details. Aristotle has reportedly been hired to work on the NASA campaign.
"The police invaded their apartment where they were living in Westlands," a Nairobi neighbourhood, Orengo said.
He added that two Ghanaian electoral consultants "coming to help us and share their experiences with us" had also been denied entry to Kenya, but did not give their names.
Orengo alleged all the incidents are part of a government plan to undermine the opposition's ability to verify results from a national election due on August 8.
"This should be seen in the context that yesterday was like an operation, not simply (targeting) this national centre but looking for everybody who would want to work with us."
Kenya's police chief has denied any such raid took place.
Nic Cheeseman, professor of African politics at Britain's University of Birmingham, said the alleged raid and deportations were a worrying sign just days ahead of the election.
Earlier this week the tortured body of Chris Msando, the election commission's technology head responsible for overseeing the electronic transmission of results, was found dumped in a forest outside Nairobi.