A man and a woman were seriously wounded with a cleaver in Paris on Friday.
The attack took place near the site of the 2015 Charlie Hebdo terror rampage.
The main suspect, known as Ali, thought the magazine still published there.
Terror police have taken up the case because of location and timing during trial.
Interior Minister Gerald Darmanin said it was 'clearly an act of Islamist terrorism'.
The chief suspect in a double stabbing in Paris told investigators he carried out the attack in anger over caricatures of the Prophet Muhammad recently republished by Charlie Hebdo, a judicial official has said.
Two people were wounded after Friday's attack with a meat cleaver outside the newspaper's former offices in eastern Paris.
Counter-terrorism authorities are investigating the stabbings as an Islamic extremist attack and seven people have been detained, including a main suspect known as Ali, 18.
Charlie Hebdo lost 12 employees in an al Qaida attack in 2015 by French-born extremists who had criticised the prophet cartoons.
The newspaper, which routinely mocks religious figures of all kinds, republished the caricatures the day before the trial into the 2015 attacks opened earlier this month.
It drew threats from militant groups as well as criticism from Muslims in multiple countries.
The magazine's location is now secret but Ali apparently believed the magazine's offices were still there.
Questioned by investigators, he acknowledged carrying out the attack and said he sought to target Charlie Hebdo because of the caricatures, according to an official close to the investigation.
Ali had been arrested a month ago for carrying a screwdriver, but was not on police radar for Islamic radicalisation, interior minister Gerald Darmanin said.
He said the screwdriver was considered a weapon, but did not explain why.
'But manifestly it's an act of Islamist terrorism,' Mr Darmanin said in an interview with the France 2 television station.
'Obviously, there is little doubt. It's a new bloody attack against our country, against journalists, against this society.'
Ali arrived in France three years ago as an unaccompanied minor, apparently from Pakistan, but his identity was still being verified, the minister said.
Seven others were detained in the aftermath of Friday's attack, including a 33-year-old Algerian, but one has been released.
Five of those in custody were detained in the Paris suburb of Pantin in a residence where Ali is believed to have lived.
The two people wounded in Friday's attack were a woman and a man working at the Premieres Lignes documentary production company who had gone outside for a cigarette.
Company co-founder Luc Hermann told broadcaster France-Info that they remained in hospital but their condition was 'reassuring'.
Prime minister Jean Castex, visiting Paris police headquarters on Saturday, pledged to step up the fight against terrorism, saying: 'The enemies of the republic will not win.'
The interior minister conceded that security was lacking on the street where Charlie Hebdo was once headquartered, and ordered special protection for all 'symbolic sites', noting in particular Jewish sites around the Yom Kippur holiday this weekend.
A Jewish grocery store was targeted days after the Charlie Hebdo newsroom massacre, in what authorities say were co-ordinated attacks.
Dramatic pictures showed Ali crouching on the floor in a yellow Manchester City top and tracksuit bottoms.
Undercover officers, identified by their orange arm bands, stood over the suspect before he was taken to a high security police station in the French capital.
Terror police have taken up the case, and French prosecutors suspect an extremist motive because of the place and timing of the stabbings - near the former Charlie Hebdo premises during a trial relating to the 2015 massacre.
The victims work for Premieres Lignes, a French news and video agency whose staff rushed to help Charlie Hebdo survivors after the rampage which killed 12 people.
Fourteen suspects are currently on trial for allegedly helping to plot the Islamist attack, with proceedings suspended yesterdatin the wake of the latest violence.
One suspected attacker was arrested on the steps of the Bastille Opera after witnesses spotted blood dripping from his clothes, said an investigating source.
'He was arrested within minutes by police, and then a second man was arrested on a Metro train because of suspicions that he may be connected with the attack,' they said.
Paris prosecutor Jean-Francois Ricard said a 'main perpetrator' had been arrested along with a 'second suspect', adding the main attacker did not know the people who were stabbed.
One witness at the Bastille Plaza, Kader Alfa, said he 'saw a guy that was in his 30s or 40s with an axe in his hand who was walking behind a victim covered in blood'.
Two suspects were taken to a high-security police station in central Paris, where they were being questioned on Friday afternoon.
The second suspect was described in French media as a 33-year-old Algerian, but it was unclear whether or how they were connected.
The attack is being investigated by specialist anti-terror prosecutors who have opened a probe into charges of 'attempted murder related to terrorism' and 'conspiracy with terrorists.'
French PM Jean Castex initially said four people were injured, but the Paris prosecutor later clarified there were two victims.
The pair work in the production team for the company which has released a number of documentaries and previously won a Pulitzer Prize for work on the Panama Papers investigation.
The prime minister noted the 'symbolic site' of the attack, 'at the very moment where the trial into the atrocious acts against Charlie Hebdo is under way.'
The PM, who attended the scene with Paris mayor Anne Hidalgo, added the lives of the two victims 'are not in danger, thank God.'
One police source said a machete had been found at the scene. Another police source said a meat cleaver had been found there.
The two people are in 'an extremely bad way', said an investigating source, although their lives are not thought to be in danger.
'Two colleagues were smoking cigarettes in the street. I heard screams. I went to the window and saw a colleague, bloodied, being chased by a man with a machete,' added another employee, who asked not to be named.
'I saw a second neighbour on the floor and I went to help.' A witness from the production company said she saw the attack being carried out.
She said: 'Two colleagues were smoking a cigarette at the bottom of the building. I heard screams and went to the window and saw one of my colleagues stained with blood, being followed by a man with a machete on the street.'
Premieres Lignes founder Paul Moreira told BFM television that the attacker fled into the metro, and the company's staff members were evacuated.
It is unclear what motivated the attack or whether it had any link to Charlie Hebdo, which moved offices after they were attacked by Islamic extremists in 2015.
The trial has heard that the attackers sought to avenge the Prophet Muhammad, nearly a decade after the magazine published cartoons mocking him.
In a Twitter post yesterday, Charlie Hebdo expressed its 'support and solidarity with its former neighbours... and the people affected by this odious attack.'
Witness Hassani Erwan, 23, told AFP: 'At around midday, we went to have lunch at a restaurant but as we were arriving, the owner started to cry 'leave, leave, there's an attack!'
'We immediately ran away and locked ourselves ourselves inside a shop with four other customers.'
A person who lives on the street told Le Parisien: 'It's starting again, the same fear there was five years ago, the same images in the street, it's heart-breaking.'
Police earlier warned there was 'extreme concern' that those responsible for the stabbings might strike again before the 'main attacker' was arrested.
Local schools in the 3rd, 4th and 11th arrondissements have been shut down, and people are being advised to stay in their offices and homes.
Valérie Pécresse, president of the Ile-de-France region of Paris, said: 'Extremely shocked by the murderous attack near the former offices of Charlie Hebdo, in a Paris arrondissement which has already paid a heavy price for violent terrorism.
'I give all my support to the authorities which are now tracking the perpetrator.'
Murmurs broke at the terrorism trial as the news of Friday's filtered through to the courtroom.
Charlie Hebdo now publishes from a secret address in Paris, and many staff members have bodyguards.
Moreira, the production company founder, described yesterday how Premieres Lignes had been on the front line of the 2015 massacre.
'We were there during the Charlie Hebdo attack. We were among the first to enter the room, we had helped the survivors.
'We note that there is now the trial of the January 2015 attacks, and that it is the same building. There are people who think that it is still the premises of Charlie Hebdo.'
Following the attacks in 2015, Premieres Lignes staff member Edouard Perrin said they barricaded the entrance to their own offices, and put bulletproof vests on.
'We took refuge on the roof,' said Mr Perrin. 'This is when I start filming on my laptop. There was an exchange of fire between the police and the terrorists coming out of the building. 'Bullets were whistling above our heads. In all, about fifty were shot, and I filmed the last ten shots.
'My fear was that they would see us, come back and finish us. We are journalists and, for them, we are not just civilians.'
It comes as a trial takes place in the French capital concerned with the January 2015 attacks that shocked the world after 12 people died.
Their primary targets were staff at the satirical magazine which had published a series of cartoons mocking the Prophet Muhammad.
The principal terrorists – who were all known to the French security services – were all gunned down by police themselves, but 14 defendants are currently on trial facing life in prison for 'complicity in terrorism'.
Friday's attack took place close to the old Charlie Hebdo offices, which were attacked by Paris-born brothers Said and Cherif Kouachi in 2015.
It marked the opening of the criminal trial by re-publishing cartoons mocking the Prophet Muhammad.
Critics said the publication had deliberately used blasphemy to stir up hatred against Muslims around the world.
The deeply incendiary images originally led to riots across the Muslim world when they were first published in the Danish daily Jyllands-Posten on September 30, 2005.
Charlie Hebdo then published them in full in 2006, leading its writers and cartoonists to receive regular death threats.
This led up to the atrocities of 2015, when the Kouachis stormed into their offices and opened fire.
Both ISIS and Al-Qaeda claimed responsibility for the 2015 attacks, which were the beginning of a wave of terrorism across France.
Another defendant is Willy Prévost, a close friend of Coulibaly, who is said to have provided vehicles including a car.
The others on trial are Nezar Mickael, Pastor Alwatik, Amar Ramdan, Said Makhlouf, Mohamed-Amine Fares, Michel Catino, Abdelaziz Abbad, Miguel Martinez and Metin Karasular.
All are accused of providing varying levels of support to the Kouachi brothers and Coulibaly.
The trial is being presided over by five specialised terrorism magistrates, headed by Judge Régis de Jorna.
The entire process will be filmed so that a record can be placed in France's National Archive, but the images will not be broadcast live.