Libyan Prime Minister Ali Zidan was seized early Thursday by a militia affiliated with a rival politician, only to be released hours later, in a flare-up of the postrevolution power struggles that have blocked Tripoli from establishing authority and security in the oil-rich country.

The gunmen, after first claiming Mr. Zidan was wanted for financial crimes, made an appeal to Libyan national pride with the claim that they were taking...