On the conjecture of Langlands and Rapoport