French counter-terrorism police are to investigate a stabbing attack in which two people were killed and five injured.

A 33-year-old Sudanese asylum seeker was arrested after the attack at Romans-sur-Isère, in the Drôme department in south-east France, on Saturday morning.

Two other men, both said to be from Sudan, one of whom shared a flat with the suspect, are also being questioned in police custody.

The national counter-terrorism brigade, PNAT, announced on Saturday evening that it had opened an investigation into “killings and attempted killings connected to a terrorist organisation” and “criminal terrorist conspiracy”.

The suspect, who arrived in France in 2017 and was granted refugee status and given a 10-year residency permit, moved to Romans-sur-Isère in January after two years in Moras-en-Valloire, to the north, where he worked in a leather goods store.

Aurélien Ferlay, the mayor of Moras-en-Valloire, told French television that the man had undergone professional training in leatherwork supported by social services and the charity Secours Catholique.

Ferlay said he was “both stupefied and horrified by this attack”, which he said had left everyone “totally mystified”.

“Nothing, absolutely nothing, made us think he would carry out this terrible act. He went to work on his bicycle, he was polite with my staff and me and he posed absolutely no problem in our community,” Ferlay said.

The local newspaper, the Dauphiné Libéré, said the man had been working in a factory at Romans-sur-Isère, a town of 33,000 residents, and was unknown to French and European police and the security services.

A statement from the counter-terrorism prosecutor’s officer said a search of the suspect’s apartment had uncovered “handwritten documents with religious connotations”. It said the as yet unidentified author of the documents “complains in particular that he lives in a country of sinners”.

The suspect entered a tobacconist shop on Saturday morning and allegedly attacked the owner and injured the shopkeeper’s wife when she tried to help her husband. He then went to a nearby butcher’s where witnesses said he jumped over the counter, grabbed another knife and stabbed a customer before running out and attacking passersby in the street.

A computer engineer aged 44 was killed while inside the butcher’s shop. The second casualty, named as Julien Vinson, 55, the owner of La Charrette, a cafe theatre, was stabbed in the street while trying to protect his 12-year-old son.

A third man, aged 63, was in a serious condition in hospital and four other people – two men, 65 and 59, and two women, 48 and 49 – were also injured.

The French president, Emmanuel Macron, described the attack as “an odious act that has brought grief to a country already sorely tested in recent weeks”.

The interior minister, Christophe Castaner, who travelled to Romans-sur-Isère after the attack, referred to the suspect’s “terrorist background”.

He said: “I commend the full engagement of the security forces who quickly apprehended the suspect and who are now carrying out the investigation.”