Costa Rican President Abel Pacheco has criticized a proposal by U.S. lawmakers to build a wall between the United States and Mexico to halt illegal immigration .