Mongolian President Nambariin Enkhbayar has declared a four-day state of emergency amid violent protests in the capital over alleged rigged elections.

Public gatherings are banned and any such meetings will be broken up, according to the TV announcement, which also includes a ban on media except for Mongolian national TV and state media organisations.

'From 11.30pm on Tuesday there will be a four-day state of emergency,' the announcement said.

It added that there would be a 10pm curfew and anyone on the streets after that time without documentation would be arrested.

The action was taken in response to the protests involving thousands of people in Mongolia's capital, voicing outrage over what they claimed were rigged elections.

Witnesses said police were forced to fire rubber bullets to quell the violence.

The headquarters of the former communist Mongolian People's Revolutionary Party (MPRP) in the centre of Ulan Bator was set alight and looted.

Thousands of protesters from the rival Democratic Party, which claims the MPRP bought votes and used other tactics to win Sunday's election, threw rocks at firefighters who arrived to put out the blaze.

Police responded by firing rubber bullets and tear gas but the clashes continued and showed few signs of abating as night fell.

Later, violence spread to other parts of the capital. A police station was attacked when protesters attempted to free rioters imprisoned earlier in the day.

Part of the Cultural Palace, which contains an art gallery, a museum and a theatre, was on fire early Wednesday as violence continued.

Up to 30 policemen and 25 civilians were injured and hospitalised in the rioting, according to television reports, citing officials and hospitals.

A European photographer said he was been beaten by police when he attempted to take photographs of police violence.

The MPRP, which ruled for decades under the protection of the former Soviet Union, says it won 45 seats in the 76-seat Great Hural while the Democrats have reportedly won 21 seats.

The General Election Committee has yet to make a formal announcement on the ballot.

The MPRP ruled Mongolia from its independence from the Chinese in 1921 until 1996, when it was beaten in elections by the Democratic Party.

In 2004, Mongolia's last general election, the MPRP and the Democrats nearly split the vote and were forced into a coalition that produced three different prime ministers.