While flowing through Montefeltro, the river flows through the exclave Santa Sofia Marecchia, which belongs to Badia Tedalda. The river then flows past Sant'Agata Feltria and Novafeltria before crossing into the province of Rimini in Emilia–Romagna. At Torello, part of the commune of San Leo, it flows 1 km west of the Sammarinese territory Acquaviva and the San Marino River flows into it, but the Marecchia does not touch the San Marino border.