A knife-waving Taiwanese set himself on fire outside the Presidential Office Tuesday in protest at what he described as an unfair court ruling, police said.

The 37-year-old, identified only by his surname Huang, doused himself with petroleum and set himself ablaze as security men approached to stop him waving a knife during the protest outside the office in central Taipei.

The fire was immediately put out by police and he was rushed to hospital.

Police said Huang suffered bad burns but his life was not in danger.

Initial investigations showed he had appealed twice to the Presidential Office in less than two months over a house leasing dispute.

Despite tight security, the building also became the target of a protester in January last year. A driver rammed a 35-ton truck through a bulletproof screen and into its main gate to vent his anger at an alleged breach of justice.