Malmesbury is situated atop a steep-sided ridge between the Sherston and Tetbury branches of the Avon, at the point of their confluence just south of the town, their combined courses almost enclosing the site so as to create a peninsula. These natural defences made it the choice for an Iron Age hill-fort which tradition later framed as a thriving British town called Caer Bladon. The Saxons also maintained it as a fortress, if we can believe the local legend that the founder of a settlement there was the Irish monk Maildub, who in the seventh century asked permission from the garrison to set up a hermitage within the fort. While such origins stories were fashionable in the Middle Ages, and we must be wary of their details, general truths might have survived in folk memory; the story of Caer Bladon and Maeldub was current at Malmesbury itself and Heremy Haslam argues [Anglo-Saxon Towns in Southern England, Chichester: Phillimore, 1984, pp.111-14] that it reflects historical fact.
The legend continues that the hermitage soon became a monastic school, one of whose students, Aldhelm, a kinsman of King Ine, founded the first abbey ca.675 and brought it aristocratic endowments. The abbey, which by the eleventh century had become one of the wealthiest in southern England, attracted settlement of a probably proto-urban character; that the parish church of Malmesbury was within, or next to, the abbey precinct, yet outside the earlier defensive ditch, suggests construction around the eighth century to serve the settlers. A parish to the north-west, just across the neck of the ridge, later became closely associated with Malmesbury as a suburb known as Westport (which comprised almost a third of the total area of the borough and within whose parish were the burgesses' common fields and pastures, one known as Portman's Heath), while the walled part of Malmesbury was known through the Late Middle Ages as Bynport, and a southern suburb may have been known as Southport, though not of equal status to the other sectors. The abbey precinct lay between Westport and Bynport, at the highest point on the peninsula, at the northern terminus of what was later the High Street already being called magna strata by ca.1300 and Heystrete at even earlier date.
Any previous urbanization of the settlement at Malmesbury was consolidated when, shortly after it was sacked by the Danes (878), Alfred refortified it as one of his burhs; it was likely at this time that any street layout was re-organized or elaborated and additional properties laid out to accommodate refugees (actual or prospective) from the surrounding countryside. In 1381 the government of Richard II was persuaded that Malmesbury had been a privileged borough since the time of Edward the Elder and that his son Athelstan had by charter confirmed the borough customs and granted the burgesses various exemptions and an area of heath, which became their common; Richard issued a confirmation of this charter and the burgesses subsequently reasserted its gist in the gild returns of 1389. This garbled version of history, whether derived from genuine local tradition or a forged charter to support undocumented practices, could have recalled provisions made to sustain the burh, Haslam believes [op.cit. p.117]. Certainly that burh seems to have been intended to serve not just as a fortress but as a civilian centre within the county. Under Ethelred II it was selected as the site of a mint and retained that function until about 1100; the mint was one of the most productive in the county.
This importance of Malmesbury is also indicated in Domesday, where Malmesbury is the first of the Wiltshire boroughs dealt with, and in the most detail; it belonged to the king, although the abbey held the majority of the real estate there, and was independent of the adjacent hundreds. Though then a royal borough, in the 1130s it was held of the Crown by the powerful and ambitious Bishop Roger le Poer of Salisbury, who had already obtained control of the abbey and wished to make Malmesbury the centre of his see; he is suspected as responsible for commencing the building of the town walls and he put up a castle to guard the sole land approach to the narrow neck of the promontory, on the north-west side of the town. He perhaps envisaged and advocated the rebuilding of the abbey, which, however, did not begin until around 1145, several years after Roger's death; construction was sufficiently advanced for it to be consecrated around 1180.
In 1215 the borough was granted at fee farm to Malmesbury abbey, which retained that control up to the Dissolution, when the farm was transferred to the burgesses. In 1215 Malmesbury seems to have been considered a hundred in its own right, but this was not necessarily the case earlier; John's charter grant included the adjacent hundreds in the fee-farm, and the abbey amalgamated these with Malmesbury Hundred. In 1216 the abbey acquired the castle, which was so close to the abbey precinct that the monks found it a nuisance, and demolished it.
The principal road south from Malmesbury connected to Chippenham, while those to the north headed to Tetbury and Cirencester (Gloucs.); farther afield roads led to Oxford and Bristol. So Malmesbury was well-positioned to take advantage of the wool trade. The layout of the medieval town much of it probably stemming back to the Alfredian burh or even earlier changed little in the post-medieval period. It featured a spinal street (High Street) running south to north along the ridge to the marketplace, which was flanked by the parish church of St. Paul's and by the abbey. Roads entering from north-west and north-east skirted the abbey precinct, then branched inwards to the marketplace, while their other branches ran south that to the west possibly following the line of an early earthwork, though outside the subsequent town wall before merging outside the walled perimeter to cross the river and continue south. Burgage plots were laid out principally along either side of the High Street and the eastern through-road, called East Street ca. 1300; they might date from the burh period, and the line of the twelfth century town wall marked the limit of their extent. Consequently later population expansion was dealt with partly by extramural settlement, particularly to north-west (Westport) and to the south (where plot boundaries have the look of a planned layout), but also hugging the outside of the western wall all areas with better access to the occupational opportunities offered by the rivers. High Street and East Street were linked by a pair of east-west lanes, so that the area enclosed within the town walls has the appearance of a grid pattern.
Malmesbury's market receives a passing mention in the 1080s, but had probably been in existence by, if not before, the time of the burh, so no market licence was required. In 1223 the king advised the sheriff that the Saturday market, previously held partly in the churchyard (presumably St. Paul's) and partly outside it, would be moved to a site known as Newmarket. If the new site was where the market cross (ca.1490) still stands, at the north end of the High Street, it was not moved far, simply shifted a little into the abbey precinct, while part of the churchyard was perhaps decommissioned excavations around the cross revealed Late Saxon burials underneath medieval re-surfacing. Another possible candidate for Newmarket is an open area, apparently never built on to any extent, between East Street and what is today known as Market Lane (named for a relatively modern use of the adjacent open space); however, there is no evidence to show this was used as a marketplace at any point in the Middle Ages, and it would have been an unusually large one. An abbey rental of the late thirteenth or early fourteenth century refers to burgage tenements in the vicinity of the market stalls and of the tollbooth (theoloneum), apparently nearby, but is ambiguous about the location of these in the town.
The abbey also obtained a Thursday market licence for Westport in 1252 but, if this was ever actually put into operation, the absorption of that part of Westport into the borough of Malmesbury, as a suburb, integrated it into the overall organization of markets, possibly by restricting its role to that of a livestock market. William I had granted the abbey a three-day fair in May, to which later monarchs added extensions to bring it to eight days; it was held in a meadow outside the town. The licence for the Westport market also included a second fair, in July, but the abbey intended this for its neighbouring manor of Whitchurch.
Malmesbury's economy appears based on the usual trades and industries exploiting wool and leather; it was both stimulated and constrained by the dominant role of the abbey. It was common for ecclesiastical lords to try to restrain burgess aspirations for greater independence of action, such as institutions of self-government, and for those aspirations to find expression through merchant gilds; so it was at Malmesbury, throughout and beyond the Late Middle Ages, and perhaps too in Westport we hear of gildhalls in both locations. The gild had no judicial jurisdiction, but its officials played a leadership role in the lay community, including joining with the burgesses (who appear to have been defined in a narrow technical sense and also to have been gildsmen) in the selection of borough representatives to attend parliaments from 1275 onwards. A complaint to the king, made probably at some time in the second half of the thirteenth century, ostensibly by the burgesses, but seemingly by the merchant gild speaking on their behalf, charged the abbot with obstructing the exercise of customs governing trade, which were claimed to have been used in the period when the king had direct lordship of the town; the specific grievances wre related: