The maker of the BlackBerry e-mail device said Friday it settled its long-running patent dispute with a small Virginia-based firm, averting a possible court-ordered shutdown of the BlackBerry system and a disruption of wireless service for millions of users.

Research In Motion Ltd. has paid NTP Inc. $612.5 million in a “full and final settlement of all claims,” the companies said.