The church dates from around the end of the twelfth century or about 1200, when it was built in Romanesque style with a narrower chancel and an apse. Its modest original size has led to the suggestion that it began life as a private estate chapel rather than a parish church. A local legend claims that two noblewomen from the nearby Ekilla estate paid for its construction, though this cannot be confirmed.
The building grew and changed considerably over the following centuries. A west tower was added in the early 1200s, initially standing apart from the nave; in unsettled times the tower is said to have served as a place of refuge and defence. Around 1300 the church proved too small for the congregation, and a brick arcade arch was built to connect the tower chamber to the nave, while the chancel arch was widened.
The most significant transformation came in the 1480s, when the wooden ceilings of nave and chancel were replaced with brick vaults, the porch was added, and the old apse was converted into a sacristy. It was at this time that the vaults and walls received their wall paintings, attributed to the celebrated church painter Albertus Pictor, which remain the building's most memorable feature.
Disaster struck in 1723 when lightning caused a severe fire, destroying the spire, roof and bell tower and cracking the tower walls; parishioners rejected a proposal to demolish the church and instead repaired it, though full restoration took until the 1740s. Further remodelling followed in the 1770s under the Stockholm master builder Alexander Högman, when windows were enlarged and the interior whitewashed and refitted. A twentieth-century restoration in 1927, led by the architect Sven Brandel, uncovered the medieval wall paintings that had been concealed for generations.
Among the furnishings is a font base carved from Gotland limestone in the 1200s, one of the oldest objects in the church, and an altar cabinet with five standing saints thought to date from the 1470s, of which only the central section survives. The pulpit and altarpiece, an oil painting of the Crucifixion, were made in the 1770s to accompany the rebuilt chancel. The church's small organ, built in 1776 by the Stockholm organ builder Jonas Ekengren and later restored to its original condition, is regarded as one of Uppland's finer older instruments. According to local tradition, the church was also once robbed by the noted Swedish outlaw Lasse-Maja, who is said to have stolen its silver; the bored-through door from that break-in is preserved by the free-standing bell tower nearby.