A politically independent judge who oversaw the country's first free elections was elected premier Friday, ending a week of uncertainty since the former Communist premier resigned.

Dimitar Popov, the head of Sofia's municipal court, was nominated earlier in the day to the 400-seat Grand National Assembly by President Zhelyu Zhelev.Assembly Chairman Nikolai Todorov announced that the parliament elected Popov by a "large majority," but he did not give the number of deputies who voted for him. He said 15 deputies voted against Popov and 29 abstained.

Bulgaria's first free elections in June were won by the Socialists, formerly the Communists. But the government of Premier Andrei Lukanov suffered months of trouble because of a severe economic crisis. Lukanov resigned Nov. 29 and has since run a caretaker government.

Popov told parliament he was accepting the job of forming a provisional government provided he gets broad support from legislators and the public at large.

He said the new government should be led by experts with profesesional qualifications, and he asked for "a common spirit of good will" to deal with Bulgaria's problems.

The surprise development came after Ginyu Ganev, the deputy chairman of parliament, refused to assume the post of premier. Sources said Todor Valchev, an economics professor, also had turned down the job.

Zhelev told parliament that he appointed Popov to form a government following long consultations with all political parties and the trade unions.

"I appeal to all political forces and labor unions to support this within the framework of the political agreement that has to be signed within the next few days," Zhelev told deputies.

Political groups are negotiating an agreement on establishing a transitional government until summer elections.