MOSCOW — A prominent Russian opposition leader, Aleksei A. Navalny, said he was briefly detained by the police on Thursday as the authorities initiated legal proceedings against him for organizing illegal protests.

The legal maneuvering was widely interpreted as a precautionary measure, intended to ensure that Mr. Navalny could be safely tucked away, if need be, in the prelude to the Russian presidential election on March 18.

The charge, which will be heard by a court at an undisclosed date, could result in a jail sentence of up to 30 days. Earlier, Mr. Navalny had predicted that he was likely to be jailed for the period around the election.

Mr. Navalny is barred from running in the election because of a criminal conviction that he and most rights advocates say was fabricated. Instead, he is leading a campaign to boycott the vote, trying to keep the turnout down and deny President Vladimir V. Putin the sweeping victory he seeks.