National police spokesman Dedi Prasetyo said security minister Wiranto was stabbed in the abdomen in the attack in Banten province, where authorities say Muslim militants have a presence.
Wiranto, 72, who uses one name, was airlifted to the capital, Jakarta, where he was in stable condition, officials said. Videos showed him being carried on a stretcher, the left side of his abdomen covered with bandages and an oxygen mask strapped to his face.
Wiranto, who was armed forces chief in the late 1990s, had just stepped out of his car and was being welcomed by the police chief in Pandeglang town when the attacker dashed toward them, wounding both along with a third man. Bodyguards wrestled the attacker to the ground and tied his hands behind his back while others helped Wiranto, who stumbled to the ground.
President Joko Widodo, who appointed Wiranto to the top security post in 2016, visited him at an army hospital in central Jakarta.
The motive for the attack, which came just a few days before Widodo's inauguration for his second five-year term in office, was not immediately clear. As coordinating minister for politics, legal, and security affairs, Wiranto supervises several ministries and agencies, including the national police and defense, which have been in charge of the government's counterinsurgency campaign.
Police said they also arrested a female companion of the attacker. Prasetyo told reporters they may have been radicalized by the Islamic State group's extremist ideology.
"The perpetrators are alleged to have been exposed to Islamic State radicalism," Prasetyo told reporters, without elaborating.
He said investigators were trying to determine whether the attackers belonged to Jemaah Ansharuf Daulah, a Muslim militant network in Indonesia aligned with the Islamic State group which security officials believe has followers in Banten. The group has been blamed for past bomb attacks in Indonesia.
As chief of the armed forces from 1998 to 1999, when the national police force was still under military control, Wiranto oversaw security and defense at a time when student protests erupted nationwide and eventually led to the fall of President Suharto in 1998.
Wiranto ran unsuccessfully for president in 2004 and for the vice presidency in 2009. He led a political party in 2014 which threw its support behind Widodo's presidential campaign.