TOBRUK, Libya — A Libyan general who has led a six-month campaign to rid the country of Islamists sharply escalated his attacks on Benghazi on Wednesday, with a concerted ground assault and airstrikes — pledging to give up command if he succeeds.

Gun battles raged in several parts of the city throughout the day to an extent not seen since the general, Khalifa Hifter, 71, began his campaign six months ago, before a backlash by Islamist militias — some of them hard-liners like Ansar Al Sharia — forced his soldiers and their allies to retreat to the outskirts of Benghazi. In a televised address announcing the assault, General Hifter, who calls his campaign Operation Dignity, declared that his men “are now ready to reach their most important goal for this phase, which is the liberation of the city of Benghazi.”

His latest advance is part of a sharp escalation of fighting on both the eastern and western ends of the country despite the urgent pleas of United Nations officials and Western diplomats for a nationwide cease-fire. “The international community cannot tolerate the continuous spilling of Libyan blood,” United Nations Secretary General Ban Ki-moon declared this week on a surprise visit to Tripoli, the capital. “If sustainable peace is not restored, prosperity and a better life will be a distant dream. This is what hangs in the balance.”

Three years after the ouster and killing of Col. Muammar el-Qaddafi, Libya has descended into a violent contest between two rival factions. One faction, which portrays itself as a bulwark against Islamist extremists, includes General Hifter; other former Qaddafi military men; certain tribal groups and the western mountain city of Zintan.