Umaru Yar'Adua took power more than a year ago
Nigerian President Umaru Yar'Adua has dismissed the country's chief of the defence staff, together with the heads of the army and navy.
Mr Yar'Adua made the announcement before going on a pilgrimage to Mecca.
No reason has yet been given for the surprise dismissals, but correspondents say it is not unusual for a new president to change military chiefs.
Nigeria has been plagued by military coups since independence but has had civilian rule since 1999.
Last year, Mr Yar'Adua became the first Nigerian civilian leader to succeed another.
This is the first time he has replaced his military heads since taking power in May 2007.
The announcement was made at a press conference at the presidential villa in the capital, Abuja.
Presidential spokesman Segun Adeniyi said the men were taking compulsory retirement.
The head of the air force, Air Marshal Paul Dike, has been promoted to become overall defence chief, the country's top military position.
The sacked three were seen as being loyalists of former President Olusegun Obasanjo.
Despite coming from the same People's Democratic Party (PDP) as Mr Obasanjo, since Mr Yar'Adua took over, there has been a series of allegations of corruption against senior members of the former administration.
Before the sackings were announced, the PDP held a press conference to criticise a group of political opponents who had been calling for the removal of the present government.
The BBC's Sola Odunfa in the commercial capital, Lagos, says making the changes at this time will not upset the apple-cart.
He says most Nigerians now accept that the military should not intervene in politics.
But he says there has been speculation that the government is not happy with the way the military has handled the unrest in the oil-producing Niger Delta region.
Attacks by militants have cut Nigeria's oil output by about 20% - a problem Mr Yar'Adua promised to address when he took power.
Local analysts accuse some military officials of being involved in the large-scale theft of oil, which Mr Yar'Adua says is behind the unrest.
Earlier this month, Mr Yar'Adua suspended the head of the government agency responsible for the development of the oil-producing Niger Delta over allegations of corruption.