South African police fired rubber bullets, tear gas and stun grenades to break up clashes between local protesters and immigrants at a rally in Pretoria against foreigners.

Hundreds marched towards the foreign ministry on Friday, calling for the deportation of foreigners who they claim have taken their jobs.

Police tried to keep protesters, some of them armed with sticks and pipes, apart from foreigners who were gathered to express alarm about recent attacks.

"There was a standoff between 100 protesters and 100 or so mostly Somali nationals who had come out onto the streets ... saying they would defend themselves, their families homes and businesses," said Al Jazeera's Tania Page, reporting from Johannesburg.

"We don't have hate! We don't have hate!" one foreign man was heard shouting in a video posted by eNCA, a local broadcaster. 

READ MORE: Calls for calm ahead of anti-migrant Pretoria rally

South Africa's unemployment rate is above 25 percent.

While some foreigners are blamed for "stealing jobs", others are accused of crimes such as drug-dealing.

Resentment against foreigners has sometimes turned deadly.

In 2015, anti-immigrant riots in and around the city of Durban killed at least six people. In 2008, similar violence killed at least 62 people.

The main group behind Friday's protests, Mamelodi Concerned Residents, remained peaceful.

But Pretoria's police said in a statement that another group of people from Atteridgeville, which is west of Pretoria, "blocked roads, burnt tyres and threw stones".

Zuma appeals for calm

Police Commissioner Khomotso Phahlane said officers arrested 136 people over the past 24 hours.

Protesters handed the ministry a petition that calls on the government to teach foreigners how to speak properly, according to the Associated Press news agency.

"They are arrogant and they don't know how to talk to people," the petition said, singling out Nigerians.

South African President Jacob Zuma condemned anti-foreigner violence and appealed for calm.

"Many citizens of other countries living in South Africa are law abiding and contribute to the economy of the country positively," Zuma said.

"It is wrong to [brand] all non-nationals as drug dealers or human traffickers."

Zuma acknowledged complaints about companies that hire illegal immigrants and said the foreign affairs office "will be cracking down on all employers who continue with this practice, which is dangerous as it pits locals against non-nationals".

Earlier this week, Nigerian homes and businesses in Pretoria were attacked in several late-night incidents, according to the Nigerian Union South Africa (NUSA).

Despite high unemployment, the country is one of Africa's largest economies and remains a draw for people from impoverished nations. 

Businesses run by Somalis, Ethiopians and others are often targeted in anti-foreigner protests.

INTERACTIVE: No place like home, Xenophobia in South Africa

The periodic backlash has hurt the image of tolerance South Africa has tried to present to the world after apartheid.

Amnesty International blamed authorities' "failure to address toxic populist rhetoric that blames and scapegoats refugees and migrants".

Amid the anti-immigrant sentiment, government statistics show a drop in the number of foreign-born people.

A report last year said the 1.6 million foreign-born people was down from 2.2 million in 2011, in a country of more than 55 million people.

Source: Al Jazeera and news agencies