NATO ends its military operation in Libya at midnight on Monday, seven months after launching an air and sea campaign that helped bring the overthrow and death of Muammar Gaddafi.

In announcing the decision last week, NATO Secretary-General Anders Fogh Rasmussen called it one of the most successful operations in the history of the 62-year-old alliance.

Rasmussen will mark the end of the mission by visiting Libya on Monday, where he will meet Libya's National Transitional Council and members of civil society, the alliance said.

Despite Rasmussen's depiction of the mission, the NATO intervention caused sharp rifts in the alliance and went on much longer than Western nations had expected or wanted.

NATO stuck to its decision to end the operation despite NTC calls for it to stay engaged longer and says it does not expect to play a major post-war role, although it could assist the transition to democracy by helping with security sector reform.

NATO took over the mission on March 31, based on a United Nations mandate that set a no-fly zone over Libya and permitted foreign military forces, including NATO, to use all necessary measures to protect Libyan civilians.

That mandate was terminated last Thursday, despite a request for the U.N. Security Council to wait for the NTC to decide if it wants NATO help to secure its borders.

NATO allies have been keen to see a quick conclusion to a costly effort that has involved more than 26,000 air sorties and round-the-clock naval patrols at a time when budgets are under severe strain due to the global economic crisis.

But NATO officials said members of the alliance are free to give further security aid to Libya individually.

The NTC officially announced Libya's liberation on October 23, days after the capture and death of Gaddafi. NATO commanders have said they believe the interim administration is able to take care of the country's security.

Libya has been the first NATO operation in which the United States sought to step back from a leading role and prompted some sharp criticism from Washington of the capabilities of allies after they failed to secure the quick results hoped for.

The U.S. ambassador to NATO, Ivo Daalder, and the alliance's top operations commander, U.S. Admiral James Stavridis, hailed the success of the mission on Monday in a commentary in the New York Times, but reiterated the need for allies to address the shortcomings in capabilities it revealed.

While calling it a true alliance effort in which non-U.S. allies flew 75 percent of the air missions, they said the United States played a leading role in destroying Libya's air defence system and providing critical resources, including the vast majority of intelligence, surveillance, reconnaissance and the aerial refuelling assets.

Fourteen NATO members and four other states provided naval and air forces, but only eight NATO nations took part in combat missions. Some big NATO states, notably Germany, had opposed the intervention.

Daalder and Stavridis said U.S. planes flew a quarter of all sorties over Libya, France and Britain a third of all missions -- most of them strike operations -- and the remaining participants flew roughly 40 percent.

(Reporting by David Brunnstrom Editing by Maria Golovnina)