In the town of Joniškėlis, formerly known as Janiškiai, a wooden shrine stood as early as 1685, founded by noblewoman Kotryna Stankevičiūtė-Puzinienė. This historic site, which later became the old cemetery known as "Mūrinės," was attacked in 1794 by participants of the Tadeusz Kościuszko Uprising. The attackers not only looted the rectory and seized liturgical items but also possibly set the shrine on fire to cover their tracks or as an act of conflict.
In 1788, thanks to the funding by Benediktas Karpis, a nobleman from Joniškėlis, the construction of a new brick shrine began on the
outskirts of the town near the Mažupė river. The construction was completed in 1792, and the church became a gem of early Classicism architecture. Its interior features a blend of Baroque and Neo-Baroque forms with a unified stylistic approach. The main altar and the uniquely designed tower, which is unusual for Lithuanian sacred architecture, are particularly noteworthy. The church's shape, reminiscent of a coffin, is linked to a legend about Benediktas Karpis, who, having sinned against his brother, was allegedly instructed by the Pope to build a shrine that would daily remind him of his crime.