In 1357, Bosnian ban Tvrtko I succumbed to Hungarian demands and ceded Tropolje to the Hungarian king Louis I the Great. That same year, Grgur Stjepanić was mentioned as Lord of Glamoč. He, along with other nobles of Tropolje, rebelled against Tvrtko, so Glamoč remained under Hungarian rule until 1387. In the meantime, Tvrtko was crowned as the King of Bosnia and with the help of Hrvoje Vukčić Hrvatinić he regained the area. At the end of the 14th century, Pavao Maštrović Klešić became Lord of Glamoč. Bosnian King Stjepan Ostoja took his lordship, but when he needed Pavao as ally he returned it to him in 1404.