(Adds statements from both governments)
TRIPOLI, April 18 (Reuters) - Heavy clashes broke out in the Libyan capital on Saturday, residents said, with gunfire and explosions heard in areas home to groups that oppose the Tripoli-based government.
The North African country is engulfed in a conflict between two governments, each allied to armed groups, who are fighting each other for power and territory four years after the ousting of autocrat ruler Muammar Gaddafi.
Gunfire and explosions could be heard since early morning in the central Fashloum district and the eastern Tajoura suburb, residents said. Shells hit several residential buildings but there were no immediate reports of casualties.
Groups in Fashloum and Tajoura oppose a government established in Tripoli after an allied faction called Libya Dawn seized the city in August and forced the existing, internationally recognised government to decamp to the east.
A senior official in Tripoli said forces loyal to his government had started a campaign in Tajoura, Fashloum and a third area "to get rid of drug dealers and all criminals loyal to (Khalifa) Haftar."
Khalifa Haftar is an army general allied to the government in the east. He and the government have said several times they wanted to retake Tripoli by force.
In a statement on Saturday the eastern government said Libya Dawn had killed and arrested residents of Fashloum and Tajoura and cut electricity and water to both areas.
Clashes involving groups backing either side have occurred west of Tripoli in recent weeks but not inside the city.
Both sides have attacked cities belonging to the other side with war planes in recent weeks, undermining talks brokered by the United Nations to form a national unity government. (Reporting by Feras Bosalum, Ahmed Elumami, Ayman al-Warfalli; Writing by Ulf Laessing; Editing by Raissa Kasolowsky)
© Thomson Reuters 2015 All rights reserved