Between 18 and 23 July these defenses, held by two Republican corps led by Colonels Ernesto Güemes and Carlos Romero, were successful in halting the Nationalist advance. The Nationalists tried to break the republican defenses with waves of infantry and intense bombing raids, but the Republican defenders through the use of well planned trenches and protected lines of communication were able to inflict heavy casualties on the Nationalists (about 20,000 casualties), suffering relatively few themselves (only 5,000 casualties). On 23 July the offensive was halting and the Republican offensive in the north on 24 July, the Battle of the Ebro, prevented any further assaults on the line by drawing away eight Nationalist divisions and their heavy artillery. The Nationalist offensive ended less than forty kilometres from Valencia.