The pullout came a day after U.S. Defense Secretary Robert Gates told Turkish leaders during a visit in Ankara that they should end the offensive as soon as possible. In Washington, U.S. President George W. Bush made a similar point Thursday, saying Turkey needed to move quickly and get out.
"Both the start and end dates of the operation were decided by us solely based on military reasoning and necessities," the military said in a statement. "Any influence, either foreign or domestic, on this decision by the Turkish Armed Forces is out of the question."
On Feb. 21, Turkey launched the incursion into northern Iraq against the Kurdistan Workers' Party, or PKK, a group fighting for the autonomy of predominantly Kurdish southeastern Turkey. The rebels have carried out attacks in Turkey from bases in Kurdish areas of northern Iraq.
The military said in a statement that the operation targeted some 300 rebels in Iraq's Zap region, and 240 of them were killed. Turkish losses stood at 27.
"Without a doubt, it is impossible to render the entire terrorist organization ineffective with an operation in only one region. However, it has shown to the group that Iraq's north is not a safe area for terrorists," the military said.
The military said it would not allow northern Iraq to be used as a springboard for attacks against Turkey.
"Terrorist activities in Iraq's north will be observed in the future and no threat against Turkey from this region will be allowed," the military said.
In October, the Turkish parliament authorized the military to strike at the rebels across the border for a year.
"If necessary, the authorization can be used again," CNN-Turk television quoted Justice Minister Mehmet Ali Sahin as saying.
Iraqi authorities have said they do not support the PKK but objected to Turkey's military action.
At least 200 military and civilian trucks ferried weary, unshaven Turkish troops from the border with Iraq and through the Turkish town of Cukurca on Friday, bound for barracks in Turkey's interior. Some soldiers in the trucks gave thumbs-up signs as they returned. Some had camouflage paint on their faces and held machine guns.
PKK spokesman Ahmad Danas confirmed Turkey's withdrawal, and speculated that American pressure had forced Turkey to pull out.
It was the first major, confirmed incursion in Iraq by Turkey in almost a decade. The PKK took up arms against Turkey in 1984. The fighting has killed up to 40,000 people.