The latest generation of linear accelerators allows the use of noncoplanar trajectories in arc therapy which combine the benefits of noncoplanar intensity-modulated radiation therapy (IMRT) treatment plans, such as improved organ sparing, with the benefits of arc therapy treatment plans, such as short treatment times. In this paper, we propose a two-step approach based on dosimetric criteria for the optimization of noncoplanar arc trajectories. In the first step, an initial set of anchor points (noncoplanar beam directions) is computed using a beam angle optimization (BAO) algorithm. In the second step, anchored in the beam directions already calculated, the noncoplanar arc trajectory is defined by iteratively computing additional anchor points considering the same dosimetric criteria used for the noncoplanar BAO. A nasopharyngeal tumor case already treated at the Portuguese Institute of Oncology of Coimbra (IPOC), is used to illustrate the benefits of the proposed optimization approach.