Complex sentence: Ritual is mediated by the fire-god Agni, through whom can the priests and thus the rest of society gain access to the Devas.
Split into simpler sentences: Ritual is mediated by the fire-god Agni. Only through Agni can the priests (and thus the rest of society) gain access to the Devas.