By June, U.S. and Filipino forces had taken control of most of the islands, except for the walled city of Intramuros. Admiral Dewey and General Merritt were able to work out a bloodless solution with acting Governor-General Fermín Jáudenes. The negotiating parties made a secret agreement to stage a mock battle in which the Spanish forces would be defeated by the American forces, but the Filipino forces would not be allowed to enter the city. This plan minimized the risk of unnecessary casualties on all sides, while the Spanish would also avoid the shame of possibly having to surrender Intramuros to the Filipino forces. On the eve of the mock battle, General Anderson telegraphed Aguinaldo, "Do not let your troops enter Manila without the permission of the American commander. On this side of the Pasig River you will be under fire".