A renin inhibitor comprising a compound represented by the formula:wherein each symbol is as defined in the description, or a salt thereof or a prodrug thereof. The compound of the present invention has a superior renin inhibitory activity, and thus is useful as an agent for the prophylaxis or treatment of hypertension, various organ damages attributable to hypertension and the like.