An assailant wielding a samurai sword and carrying a Chinese flag in his bag has injured a guard outside Taiwan's presidential office building in what authorities are calling a politically-motivated attack.

The 51-year-old man, identified by his surname, Lu, was overpowered by other guards and prevented from entering the building in the center of the capital. It wasn't immediately clear if President Tsai Ing-wen was in her office at the time of Friday's attack. The guard was being treated for a wound to his neck.

The official Central News Agency says a Chinese flag was found in Lu's bag and quoted a police official as saying that he told officers he committed the attack to "demonstrate my political position." It said Lu had stolen the sword from a nearby museum.