CARACAS, Venezuela — Leaders of Venezuela’s opposition on Tuesday set in motion a plan to try to oust President Nicolás Maduro and create a caretaker government until new elections can be held.

The National Assembly, the opposition-controlled legislative body, declared Mr. Maduro illegitimate, hoping to trigger a constitutional mechanism that would allow the head of the assembly to take over the leadership.

It was not immediately clear what effect the move would have or how Mr. Maduro’s government would react.

Rafael Chavero, professor of constitutional law at the Central University of Venezuela, said the next steps were not clear. “You have to think outside the box,” he said. “There is no magic formula to get out of dictatorships.”