Brazil Congress storming: Lula's security chief resigns
The top national security adviser to Brazilian President Luiz Inácio Lula da Silva has resigned after video emerged showing the aide inside the presidential palace in Brasilia during rioting on 8 January.
Gen Marcos Gonçalves Dias stepped down after CNN Brasil broadcast CCTV footage of him talking to members of a mob.
The general denied accusations that he had facilitated the rioters' entry.
The government is now backing a congressional inquiry into the riots.
This comes on top of an investigation by federal police.
Gen Gonçalves Dias said he had arrived after the rioters.
CNN Brasil said it had analysed 160 hours of footage from 22 separate cameras.
In its report, the broadcaster showed footage of Gen Gonçalves Dias in the same corridor as some of the people who had stormed the building.
CNN says the footage was recorded in the corridor outside a room leading to the office of the president on the third floor of the palace.
The images appear to show the general pointing out the emergency exit to the rioters. There is no sound, so it is not clear what he says to them.
The general told Brazilian TV channel GloboNews that he "was removing people from the third and fourth floors so that they could be arrested on the second floor".
Gen Gonçalves Dias argued that his actions had prevented the ransacking of the third and fourth floor of the palace.
He added that he had handed in his resignation so that the investigation could proceed "in a transparent way".
Other footage broadcast by CNN appears to show members of the Institutional Security Bureau (GSI), which Gen Gonçalves Dias leads, handing out bottles of water to some of the rioters and shaking hands with them.
Gen Gonçalves Dias said those shown handing water to the rioters had been removed from their posts and were currently under investigation.
The presidential palace was one of three buildings in Brasilia which rioters opposed to the election of President Lula stormed on 8 January.
Opponents of the newly elected president had been camping out in front of army barracks across the country in an attempt at convincing the army to prevent the transfer of power from the outgoing far-right president, Jair Bolsonaro, to Lula.
With their frustration growing after Lula's swearing-in on 1 January, they began to congregate in the capital.
On 8 January, they rampaged through the presidential palace as well as Congress and the Supreme Court, breaking windows and furniture as well valuables, such as a 17th-Century French clock. They caused millions of dollars of damage.
Security forces eventually regained control of the situation and detained around 1,500 people.
But the security forces came under heavy criticism for not preventing the rioters from entering these key buildings.
The chief of security for the capital at the time of the attack, Anderson Torres, is in jail awaiting trial on charges of sabotaging efforts to protect the buildings.
President Lula's predecessor in office, Jair Bolsonaro, is due to testify within the coming days over his alleged role in inciting the rioters.
Prosecutors say he fanned the flames by questioning the legitimacy of the election result, which saw him narrowly lose to Lula.
Lula had opposed the congressional inquiry in order to avoid diverting political focus away from his economic measures.
But Institutional Relations Minister Alexandre Padilha told reporters the government would now support the inquiry as a way to clear things up after the resignation of Gen Gonçalves Dias.
Some members of the opposition have accused the government of allowing the rioters entry to the presidential palace.
"That's an absurd conspiracy theory," Mr Padilha said, according to Reuters news agency. "The leaked footage brought in a new political fact so we will support the inquiry, which in my opinion will put an end to yet another conspiracy theory."