  Infinite horizon backward stochastic Volterra integral equations (BSVIEs for
short) are investigated. We prove the existence and uniqueness of the adapted
M-solution in a weighted $L^2$-space. Furthermore, we extend some important
known results for finite horizon BSVIEs to the infinite horizon setting. We
provide a variation of constant formula for a class of infinite horizon linear
BSVIEs and prove a duality principle between a linear (forward) stochastic
Volterra integral equation (SVIE for short) and an infinite horizon linear
BSVIE in a weighted $L^2$-space. As an application, we investigate infinite
horizon stochastic control problems for SVIEs with discounted cost functional.
We establish both necessary and sufficient conditions for optimality by means
of Pontryagin's maximum principle, where the adjoint equation is described as
an infinite horizon BSVIE. These results are applied to discounted control
problems for fractional stochastic differential equations and stochastic
integro-differential equations.
