In August, rebel forces launched an offensive on the government-held coast of Libya, backed by a wide-reaching NATO bombing campaign, taking back territory lost months before and ultimately capturing the capital city of Tripoli, while Gaddafi evaded capture and loyalists engaged in a rearguard campaign. On 16 September 2011, the National Transitional Council was recognised by the United Nations as the legal representative of Libya, replacing the Gaddafi government. Muammar Gaddafi evaded capture until 20 October 2011, when he was captured and killed in Sirte. The National Transitional Council "declared the liberation of Libya" and the official end of the war on 23 October 2011.