The Llanelly and Mynydd Mawr Railway was authorised in 1875. It made use of part of the long defunct Carmarthenshire Railway or Tramroad of 1801. The older line began running trains in 1803, and was a plateway of about gauge, with horse traction, for the purpose of bringing minerals from the Mynydd Mawr to the sea for onward shipment at Llanelly Docks.

The Llanelly and Mynydd Mawr line opened in 1881, worked by the contractor, John Waddell, who had built the line and taken a majority of the shares. The fortunes of the company were closely bound with those of the mineral industries, which fluctuated considerably. The company considered operating a public passenger service but never did so, although workmen's trains were operated for some years. The decline of coal mining in the area seemed to be reversed when the huge new Cynheidre Pit was established in the 1960s, but the railway capacity enhancements to deal with the expected upsurge in traffic proved to be unnecessary. The line closed completely in 1989.

Early waggonways

In the 1760s the area around Llanelly had considerable colliery activity, and there were five short canals from pits to the sea shore; the heavy mineral was brought to shipping for onward transport, at a time when there were no usable roads or railways.

In 1769 Kymer's Canal was opened between pits in the Gwendraeth Valley and the coast; there were a number of basic wooden tramways in connection with it, covering the short distance between the mouth of the pits and the nearby canal.

At the time coal was loaded into ships at Llanelly by beaching them on the mudflats, or using lighters to ferry coal out to larger vessels anchored off-shore. Wharves were an obvious solution, and one of the first was built in 1795 to serve a canal from pits owned by William Roderick, Thomas Bowen and Margaret Griffiths. This was later developed as the Pemberton's Dock.

In March 1797 Alexander Raby arranged a lease with Dame Mary Mansell, owner of the Stradey Estate, entitling him to work coal measures on the estate. Raby undertook to mine 5,000 tons of coal annually and there were penalties if he failed to do so (or to pay the corresponding royalty). In January 1798 he concluded further leases on the property, and one of these authorised him to construct his own tramroad to connect his coal and ironworks with a new shipping place on the mudflats at Llanelly. Raby's 'new iron way' was built on the alignment of an earlier waggonway which had linked the Caemain pit with what was then the beach at Sandy.

Alexander Raby's dock was a short distance to the north-west of Pemberton's Dock, and it later became known as the Carmarthenshire Dock. This dock and the tramroad serving it came into use by 1799. The most notable feature of the tramroad was an iron bridge over the River Lliedi at Sandy, which is believed to have been the world's third iron railway bridge.

The Carmarthenshire Railway or Tramroad A canal was still under consideration to connect the collieries in the hills with the harbour at Llanelly, but it was realised that the hilly terrain was difficult for canals, and from 1800 Raby planned a tramroad instead. In 1801 he promoted the Carmarthenshire Railway or Tramroad;The ambiguity "Railway or Tramroad" is used repeatedly by Price, and also by Carter. it was authorised by the Carmarthenshire Railway or Tramroad Company Act 1802 (42 Geo. 3. c. lxxx) on 3 June 1802 and was the third to do so after the Lake Lock Rail Road and the Surrey Iron Railway. Capital was £25,000 and it was to use the trackbed of a former waggonway. It was also to construct a harbour at the mouth of the River Lliedi.

The act empowered the company to acquire Raby's dock and tramroad system, and provided for the extension of the line to Castell-y-Garreg, about west of Llandybie. The tramroad was a plateway, using L-shaped plates so that ordinary wagon wheels could run on it; the plates were supported on stone blocks. Although Raby had been the prime mover in consideration of tramways at Llanelly, the new Company was a joint-stock company, and there were several other shareholders. The engineer was James Barnes.

The gauge seems to have been : the engineer's report of September 1801 stated his intention that the line should be built with "rails laid 4 Feet asunder". However, Price records the recollection of an unnamed "old retainer" on the estate: he wrote

Price speculates that several earlier tramroads in the area were built to the gauge of , but that the Carmarthenshire Railway or Tramroad was built to match the gauge of Raby's line, rather than the others.

The first section of line was opened for traffic from the ironworks at Cwmddyche to the water's edge at Llanelly in May 1803, a distance of . This is claimed to be the first publicly authorised railway in use in Britain, because the Surrey Iron Railway, although authorised earlier, was not ready for traffic until July 1803. In fact by then the first of the Carmarthenshire Railway or Tramroad, together with certain branches, were already in use. Earthworks were considerable for a tramroad, and the ruling gradient was limited to 1 in 38.

By November 1803 the line was open as far as Brindini (Cynheidre), at an altitude of above sea level. A considerable embankment was necessary on Mynydd Mawr itself, which delayed opening there until November 1804 and the line was completed to Gorslas (Cross Hands) in 1805. During the construction process near Cross Hands several outcrops of anthracite coal were discovered.

The line flourished, and in November 1805 plans were considered for further improvements to the dock at Llanelly. There were numerous branch connections to industrial premises mostly under Raby's control, and the line was to be doubled "from the turnout place at Lime Kiln [Cwmddyche] to the turnout place at Old Castle." There was opposition to this from some of the London shareholders and it is not certain whether the doubling work was actually carried out.

There were financial difficulties in the company: at a shareholders' meeting on 7 November 1805 there was a clear body of opinion that Raby had diverted the company's resources to his own benefit. On 15 August 1806 a special general meeting was held, at which a report was presented outlining unauthorised branches built by Raby, and the fact that his own wagons had used the line without paying the toll. The financial criticism of Raby gathered pace and in June 1807 he was obliged to sell most of his industrial property to pay debts. Debt had been incurred on the railway too, and by November 1809 the commercial activity on the line was at a very low level. Raby continued his activities locally, although increasingly under the financial patronage of others, in effect a salaried manager. He left the area as a result of worsening finances in 1826.

Technical progress in railways had developed edge rails, which were capable of carrying heavier wheel loads, and it is likely that an edge railway had been built alongside the lower part of the Carmarthenshire alignment before 1832, by which time the now-outmoded Carmarthenshire Tramroad had fallen into disuse north of Felin Foel.

Carter records that the Carmarthenshire raised further subscriptions in 1834 for improvement works, and that the company was re-incorporated in 1864–1865.

The Kidwelly and Llanelly Canal Company

Thomas Kymer had made a canal from his pits at Pwllyllygoed to a harbour at Kidwelly about 1769. In 1811 it was proposed to extend the canal to Pontyberem and also to Llanelly, and the Kidwelly and Llanelly Canal Company was formed to do so; in 1812 it obtained an authorising act of Parliament, the Kidwelly and Llanelly Canal and Tramroad Company Act 1812 (52 Geo. 3. c. clxxiii), and the extensions were permitted to be canals or tramroads, to Cwm-y-Glo near Cwmmawr and to a basin at Llanelly. The canals were constructed and in operation, but neither the tramroad nor the connection to Llanelly were made until 1837, but the new facility at Kidwelly was an obvious competitive threat to the Llanelly interest.

In 1833 the considered what extensions could be made, and a report recommended extending the canal to Cwmmawr, although that would involve three inclined planes. A "branch railroad" would be built above that point. In fact that may not have been constructed, but early in June 1837 the company completed its tramway from Pembrey to Llanelly.

The Llanelly Railway

In 1835 the Llanelly Railway obtained powers to build from St David's Pit, above Dafen, to connect with the Carmarthenshire Railway or Tramroad at Felin Foel. The Llanelly Railway was to be an edge railway, and it seems to have been assumed that the Carmarthenshire line would be converted to that system; however this line was never built. From September 1839 anthracite coal from Mynydd Mawr was brought to Llanelly by the Llanelly Railway, by-passing the Carmarthenshire line, taking an easterly sweep through the present-day Ammanford).

Llanelly Harbour Commissioners The state of Llanelly Harbour had long given cause for concern, and by the Burry, Loughor and Lliedi Rivers Navigation Act 1843 (6 & 7 Vict. c. lxxxviii) the Llanelly Harbour Commissioners were authorised to raise money and improve the harbour, also acquiring the Carmarthenshire Dock from the Carmarthenshire Railway or Tramroad Company and altering the course of the River Lliedi to improve scour. By now the majority of the Carmarthenshire Railway or Tramroad route was disused, but the Carmarthenshire Railway or Tramroad Company remained in existence.

South Wales Railway

The Great Western Railway supported a nominally independent South Wales Railway that was to connect Gloucester (and thence London over the GWR) with Fishguard, forming a route to Ireland by ferry and (it was hoped) in due course North America. This railway opened through Llanelly (from Swansea to Carmarthen) on 11 October 1852, although the western terminus was altered. The South Wales Railway was built on the broad gauge, for compatibility with the Great Western Railway. In 1858 the Llanelly Harbour Commissioners obtained Parliamentary authority to build a broad gauge branch line from the SWR to the western harbour breakwater, closely following the Carmarthenshire alignment.

The South Wales Railway had been conceived as a partner with the Great Western Railway, but the financial aspect of the relationship was somewhat shaky. However, in 1862 the Great Western Railway absorbed the South Wales Railway. The broad gauge was increasingly a liability in South Wales, where much of the activity of extracting coal took place in areas served by local, narrow gauge lines, and the transshipment to broad gauge wagons was a massive deterrent. The Great Western Railway determined to convert the gauge of its lines in South Wales to what had become "standard" gauge, and did so in May 1872.

The Llanelly and Mynydd Mawr Railway authorised

In 1872 ideas were revived of building a standard gauge line from Llanelly to Mynydd Mawr, giving improved access to the collieries there. Enthusiasm was considerable and the Llanelly and Mynydd Mawr Railway was authorised by an act of Parliament, the (38 & 39 Vict. c. clxiv), on 19 July 1875; share capital was £60,000. The new line was to be in length, and to cross the South Wales Railway main line by a bridge. The alignment further on was generally close to the old Carmarthenshire route, but not exactly following it. The Carmarthenshire property was to be purchased for £1,400.

Raising capital proved to be exceedingly difficult, and negotiations took place with various contractors who, the Directors hoped, might be willing to finance the construction themselves by taking shares instead of cash payment. This proved fruitless and after four years, on 31 October 1879, the Shareholders accepted a recommendation to abandon the scheme for the railway.