Danish police said Monday that they had arrested two men suspected of helping the gunman who carried out attacks on a free speech event and a synagogue over the weekend.

A defense lawyer for one of two men says both have been jailed for 10 days, following a custody hearing Monday.

Anders Rohde said prosecutors had asked a judge to place them in four weeks of solitary confinement and that the relatively short period of detention suggests the case against the men is "thin."

Rohde spoke to reporters after a four-hour custody hearing held behind closed doors.

Earlier, Michael Juul Eriksen, the other defense attorney, told reporters that the men deny allegations of giving the gunman shelter and getting rid of a weapon.

A statement from investigators said the two men "are charged with helping the perpetrator with advice and deeds."

Authorities have not identified the gunman, but have described him as a 22-year-old Dane with a history of violence and gang connections. Denmark's security service said he may have been inspired by the terror attacks by Islamic extremists in Paris that killed 17 people.

The gunman was released from jail just two weeks ago and might have become radicalized there last summer, a source close to the Danish terror investigation told The Associated Press on Monday.

Two Danish sources close to the investigation confirmed to the AP that the gunman was named Omar Abdel Hamid El-Hussein. Several Danish media have already named him.

One source told the AP that the gunman had been in pre-trial detention for a long time but was released two weeks ago. He also said the corrections authority had alerted Danish security service PET last year after they noticed worrisome changes in his behavior. He wouldn't elaborate.

Police spokesman Joergen Skov said Monday the gunman visited an Internet cafe late Saturday, about six-and-a-half hours after the first attack. Police raided the facility on Sunday and detained four people, including the two men arraigned on Monday, Skov said. The other two were released.

Investigators released new images of the suspect and asked witnesses who had seen him enter or leave the Internet cafe to contact police.

"We are of course interested in whether he was alone and whether he was carrying anything and in which direction he went," Skov said.

Denmark's red-and-white flag flew at half-staff from official buildings across the capital Monday. Mourners placed flowers and candles at the cultural center where documentary filmmaker Finn Noergaard, 55, was killed and at the synagogue where Dan Uzan, a 37-year-old security guard, was gunned down.

There was also a smaller mound of flowers on the street at the location where the gunman was slain.

The prime ministers of Denmark and Sweden were expected to join thousands of people at memorials in Copenhagen on Monday evening.

Denmark has been targeted by a series of foiled terror plots since the 2005 publication of 12 caricatures of the Prophet Muhammad in the newspaper Jyllands-Posten. The cartoons triggered riots in many Muslim countries and militant Islamists called for vengeance.

One of the participants in the free speech event targeted Saturday was Swedish artist Lars Vilks, who caricatured the prophet in 2007. Vilks, who was whisked away by his bodyguards and was unharmed, told The Associated Press he thought he was the intended target of that attack.

Other participants said they dropped to the floor, looking for places to hide as the shooting started. The gunman never entered the cultural center but sprayed it with bullets from outside in a gun battle with police.

World leaders, including British Prime Minister David Cameron, German Chancellor Angela Merkel and U.N. Secretary-General Ban Ki-moon, condemned the Copenhagen attacks.

French President Francois Hollande visited the Danish Embassy in Paris on Sunday and Paris Mayor Anne Hidalgo was in Copenhagen on Monday in a show of solidarity.

"The terrorist attacks have the same causes in Paris and Copenhagen," Hidalgo said. "Our cities are symbols of democracy, Paris and Copenhagen. We are here and we are not afraid."

The Associated Press contributed to this report.