Background and study aims: Inadvertent injection of contrast agent into the pancreatic duct is believed to be an important contributor to pancreatitis occurring after endoscopic retrograde cholangiopancreatography (post-ERCP pancreatitis, PEP). Our aim was to examine whether primary deep biliary cannulation with a guide wire is associated with a lower rate of PEP than conventional contrast-assisted cannulation. Patients and methods: From August 2003 to April 2006 all patients with an intact papilla who were referred for ERCP were eligible. Patients with pancreatic or ampullary cancer were excluded. Patients were randomized to undergo sphincterotome biliary cannulation using either contrast injection or a guide wire. The ERCP fellow attempted initially for 5 minutes. If unsuccessful, the consultant attempted for 5 minutes using the same technique, followed by crossover to the other technique in the same sequence and then needle-knife sphincterotomy where appropriate. Patients were assessed clinically after the procedure, then followed up with telephone interviews after 24 hours and 30 days, and serum amylase and lipase tests after 24 hours. Results: Out of 1654 patients undergoing ERCP, 413 were included in the study. PEP occurred in 29/413 (7.0%): 16 in the guide-wire arm, 13 in the contrast arm (P = 0.48). The overall cannulation success rate was 97.3%. Cannulation was successful without crossover in 323/413 patients (78.2 %): 167/202 (81.4 %) in the guide-wire arm and 156/211 (73.9%) in the contrast arm (P = 0.03). Multivariate analysis demonstrated female sex (OR = 2.7, P = 0.04), suspected sphincter of Oddi dysfunction (OR-5.5, P = 0.01), and complete filling of the pancreatic duct with contrast agent (OR = 3.5. P = 0.02) to be independently associated with PEP. The risk of PEP increased incrementally with each attempt at the papilla (OR 1.4 per attempt, P= 0.04) to greater than 10% after four or more attempts. Conclusions: The guide-wire technique improves the primary success rate for biliary cannulation during ERCP but does not reduce the incidence of PEP compared to the conventional contrast technique. The incidence of PEP increases incrementally with each attempt at the papilla.