What is the fastest way of finding a randomly hidden target? Experimental observations reveal that the search behavior of foraging animals is generally intermittent: active search phases randomly alternate with phases of fast ballistic motion. Here, we study the efficiency of this two state search strategy by calculating analytically the mean first passage time at the target. We model the perception mechanism involved in the active search phase by a diffusive process. We show that the search strategy is optimal when the average duration of "motion phases" varies like the power either 3/5 or 2/3 of the average duration of "search phases" depending on the regime. This scaling accounts for experimental data over a wide range of species, which suggests that the kinetics of search trajectories is a determining factor optimized by foragers and that the perception activity is adequately described by a diffusion process.