Belgian police have detained a suspect after an attacker tried to crash a car through the gates of an army barracks, fleeing in the vehicle after shots were fired.

The incident occurred in Flawinne, near the French-speaking town of Namur, at a major military barracks which is home to the 2nd Commando Battalion.

Lieutenant General Claude Van De Voorde, defence cabinet chief, said that "one car tried to get into the barracks. There was one person in the car", who then fled.

Police detained a suspect three hours after the attack following a manhunt which also involved helicopters surveying the scene, said prosecutor's spokesman Vincent Macq.

There were no immediate reports of serious injuries at the barracks, said Tony Langone, a defence spokesman.

"For the moment there are no elements which would allow us to say we are facing a terrorist examination," a spokesman for prosecutors in Namur told a news conference.

"The theory of an isolated incident or one of a psychologically unstable person cannot be ruled out," he said.

A busted-up Ford was found close by the barracks which police investigated.

Van De Voorde could not confirm media reports that there were explosives in the car. "People start making up things quickly," he said.

Since a lone gunman killed four people in the May 2014 attack on the Jewish museum in Brussels, Belgium has been on high alert for further attacks.

In January, police killed two men and arrested a third in a counterterrorism raid in the eastern city of Verviers, targeting a group suspected of plotting a major attack.

Belgium has been one of the largest recruiting bases per capita for foreign fighters travelling to join the Islamic State of Iraq and the Levant (ISIL) group, and authorities have openly expressed alarm about what the recruits might do if they return.

A preliminary report this month from a UN Working Group on the use of mercenaries estimated 500 people have been recruited from Belgium to fight in Iraq and Syria.

Source: Agencies