In 1859, Wallachia united with Moldavia to form the United Principalities, which adopted the name Romania in 1866 and officially became the Kingdom of Romania in 1881. Later, in 1918, Transylvania was ceded by the Treaty of Trianon from Hungary to the Kingdom of Romania, forming the modern Romanian state.