A phase II clinical trial in cancer therapeutics is usually a single-arm study to determine whether an experimental treatment (E) holds sufficient promise to warrant further testing. When the criterion of treatment efficacy is a binary endpoint (response/no response) with probability of response p, we propose a three-stage optimal design for testing H0: p < or = p0 versus H1: p > or = p1, where p1 and p0 are response rates such that E does or does not merit further testing at given levels of statistical significance (alpha) and power (1--beta). The proposed design is essentially a combination of earlier proposals by Gehan and Simon. The design stops with rejection of H1 at stage 1 when there is an initial moderately long run of consecutive treatment failures; otherwise there is continuation to stage 2 and (possibly) stage 3 which have decision rules analogous to those in stages 1 and 2 of Simon's design. Thus, rejection of H1 is possible at any stage, but acceptance only at the final stage. The design is optimal in the sense that expected sample size is minimized when p = p0, subject to the practical constraint that the minimum stage 1 sample size is at least 5. The proposed design has greatest utility when the true response rate of E is small, it is desirable to stop early if there is a moderately long run of early treatment failures, and it is practical to implement a three-stage design. Compared to Simon's optimal two-stage design, the optimal three-stage design has the following features: stage 1 is the same size or smaller and has the possibility of stopping earlier when 0 successes are observed; the expected sample size under the null hypothesis is smaller; stages 1 and 2 generally have more patients than stage 1 of the two-stage design, but a higher probability of early termination under H0; and the total sample size and criteria for rejection of H1 at stage 3 are similar to the corresponding values at the end of stage 2 in the two-stage optimal design.