Hassene Dridi, Associated Press
Tunisia's prime minister Habib Essid adresses the parliament in Tunis, Wednesday, July 8, 2015. ays that authorities believe plots aimed at massive deaths and destruction of the country's economy are in the works, and justify the state of emergency declared after a second deadly attack on tourists in three months.

TUNIS, Tunisia — Tunisia's army and contractors are building a barrier along part of the country's border with Libya to keep out extremists in the wake of attacks claimed by the Islamic State group.

Prime Minister Habib Essid said the goal is to render the border "impassable" by jihadi fighters and vehicles, and construction should be finished this year.

Essid told Tunisian TV the barrier will cover 168 kilometers (105 miles) — about one-third of the border — and will include fencing, a sand wall, trenches and surveillance posts.

Tunisia's government declared a state of emergency days after a gunman killed 38 tourists, mostly Britons, on June 26 in the coastal resort of Sousse. In March, two attackers fired on tourists and others at Tunis' National Bardo Museum, killing 22 people.

Authorities say the three gunmen, who were shot dead by security forces, received weapons training in Libya.

A prosecutor's office official, Belhassen Oueslati, said three suspected accomplices in the Sousse attack are also in police custody.

Other recent government security measures include firing some security officials, sending more than 1,300 security forces to patrol hotels, beaches and other tourist sites and closing 80 mosques whose leaders were said to incite terrorism.

Rights groups say the state of emergency mustn't trample freedoms in Tunisia's fledgling democracy. Essid insisted in parliament Wednesday the moves instead aimed "to preserve the democratic achievements" in the country.

"Today's Tunisia is not yesterday's Tunisia," he said. "The state must act in line with the law."

Tunisia overthrew its dictator in 2011, setting off the Arab Spring revolutions. While successive governments have fostered democracy in Tunisia, Libya has fallen into near-chaos — now divided between rival governments with hundreds of militias roaming the country.