Libyan authorities on Thursday granted immunity to former rebels who fought to oust Muammar Qadhafi

"There is no punishment for acts made necessary by the February 17 revolution," read the law published on the National Transitional Council's website.

The immunity covers "military, security or civilian acts undertaken by revolutionaries with the aim of ensuring the revolution's success," the NTC added.

February 17 marks the start of a popular uprising which led to the collapse of Qadhafi's regime last year.

It was unclear if the law includes acts committed after October 23, when the NTC declared Libya's liberation following the capture and killing of strongman Qadhafi.

Rights groups say war crimes were committed by both sides during the 2011 conflict and warn of torture in detention centers run by militias made up of former rebels.

The law also orders the defense and interior ministers to bring to justice Qadhafi's fighters detained by former rebels or release them by July 12 if there is not enough evidence against them.

The ministers must also act against individuals who pose a "threat to the security or stability" of Libya on the basis of their role in the previous regime or their participation in "official and unofficial bodies of the former regime."

These measures could include surveillance, travel bans or barring them from residence in a specific place or region of the country.

In further legislation to govern the transition towards a new Libya, the NTC criminalized the glorification of Qadhafi or his regime.

"Praising or glorifying Moamer Qadhafi, his regime, his ideas or his sons… is punishable by a prison sentence," said the text of the law read out to reporters by a judicial official after a high-level meeting.

"If those news reports, rumors or propaganda cause any damage to the state, the penalty will be life in prison," the official quoted the text as saying.

"In conditions of war, there is a prison sentence for any person who spreads information and rumors which disrupt military preparations for the defense of the country, spread terror or weaken the citizens' morale," he added.

According to the law, Libya is still in a state of war following the 2011 bloody conflict that pitted Qadhafi loyalists against NATO-backed rebel forces.

A third law for the transition stipulates prison sentences for anyone who "attacks the February 17 revolution, denigrates Islam, the authority of the state or its institutions."

And another law confiscates all property and funds belonging to figures of the former regime, including Qadhafi's relatives, placing them under the care of the judiciary.

The tough legislation comes just weeks before elections for a constituent assembly which the NTC has pledged to hold in June.

Libyan authorities have already disqualified members linked to the Qadhafi regime from running for public office, in regulations that rights group have slammed as "vague."