We study possible correlations between ultrahigh energy cosmic rays (UHECRs), observed by Auger, AGASA, and Yakutsk, and nearby active galactic nuclei (AGNs) and F ermi sources. We consider the deflection effects by a Galactic magnetic field (GMF) model constrained by the most updated measurements. We found that the average deflection angles of UHECRs by the Galactic magnetic fields are less than 4 • . A correlation between the Auger cosmic-ray events and nearby AGNs with a significance level of ∼ 4σ was found for the Auger UHECR data sets with or without deflection correction. No correlation was found between the AGASA/Yakutsk events with nearby AGNs. Marginal correlations between the Auger events and the F ermi sources, and between AGASA events and F ermi AGNs were found when the deflections calculated by the GMF model were considered. However, no correlation was found between the Yakutsk data and F ermi sources. Some F ermi sources are close to the arrival directions of UHECR events detected by Auger, AGASA, and Yakutsk, most of which are probably chance coincidence rather than objects producing UHECRs in the nearby Universe. Four F ermi sources, NGC 4945, ESO 323-G77, NGC 6951, and Cen A, within 100 Mpc have UHECR events within 3 • . 1 from their positions, which could potentially be cosmic-ray accelerators. However, the association can only be confirmed if more UHECRs are preferably detected in these directions Subject headings: (ISM:) cosmic rays -galaxies: active -magnetic field -methods: statistical