CARACAS — Venezuela’s authoritarian leader, Nicolás Maduro, moved on Sunday to consolidate his grip on power by taking control of the country’s last independent institution and sidelining the lawmaker who had staked a rival claim to the presidency.

As Mr. Maduro’s security forces surrounded the National Assembly building, his supporters blocked the re-election of the opposition leader, Juan Guaidó, as the body’s head. That deprived Mr. Guaidó of the position that allowed him challenge to Mr. Maduro’s leadership.

By the end of a chaotic day, Venezuela’s political turmoil had somehow found a way to worsen.

The country already had two men who claim to be its rightful president and two rival legislatures. Now, one of the legislative bodies has two competing leaders.

After Maduro backers elected their own man on Sunday to lead the National Assembly, Mr. Guaidó’s supporters gathered at a newspaper’s headquarters, and in a dramatic roll call vote, re-elected him to the leadership position.