The attack took place during a routine check at the city's main train station at around 8pm on Thursday. The three victims were hospitalized but not in critical condition and one of the army officers had already been discharged by Friday morning.
Police initially told reporters that the attacker had been arrested for attempted murder and that the incident was not being treated as terrorism.
But later on Friday, prosecutors said they had opened an investigation into alleged 'international terrorism', according to a report by news agency Ansa. Police said they were investigating whether the man was behind a Facebook profile which had shared at least one video in support of terror group Isis, as well as whether he had ties to Islamic extremists.
The suspect came from a "difficult family", police said in a press conference, and had been homeless for some time. He was known to authorities for drugs offences. After being arrested, he reportedly told police: "I am alone and abandoned."
Tensions have been high around Milan's central station in recent weeks after police ordered dozens of migrants to move on from the area, in an operation involving helicopters, sniffer dogs, and mounted police at the start of the month. Milan's mayor later distanced himself from the raid, saying "these methods are not our model".
Lombardy's regional president, Roberto Maroni of the far-right Northern League, called for a planned pro-migrant march to be cancelled on Saturday "out of respect for the wounded officers".
But mayor Giuseppe Sala hit back at the suggestion, saying: "The criminal who stabbed these law enforcement officers was Italian in all respects. Nevertheless, it is 'convenient' to blame this criminal act on migrants."
Sala, who visited the injured officers in hospital, said he would lead the Together Without Walls march "for a safe and welcoming Milan."
The terror threat in Italy is currently at level 2, the highest possible in the absence of a direct attack. The country has strengthened security measures, particularly in crowded areas and around major landmarks, following terrorist attacks on other European cities.