WASHINGTON, July 25  Saying the security situation in Baghdad remained “terrible,” President Bush announced an agreement with Prime Minister Nuri Kamal al-Maliki on Tuesday to significantly strengthen the United States military presence in the city.

The announcement, presented at a joint news conference during Mr. Maliki’s first visit to the White House since taking office in May, was a tacit admission that the Iraqi government had not succeeded in bringing stability to the capital, and that any major withdrawal of American troops soon remained unlikely.

Under the new security plan, devised by American military commanders in consultation with the Iraqis, some 4,000 United States troops would move into Baghdad, to join the same number of Iraqi counterparts. The United States has about 128,000 troops in Iraq, approximately 7,200 of them in Baghdad, according to military officials there.

“Obviously, the violence in Baghdad is still terrible, and therefore there needs to be more troops,” Mr. Bush said at the news conference, held in the East Room after a morning meeting with Mr. Maliki in the Oval Office. “Our military commanders tell me that this deployment will better reflect the current conditions on the ground in Iraq.”