The Battle of Valjevo was undertaken by the Serbian rebel army led by archpriest Matija Nenadoviàand knez Nikola Grboviàagainst the city of Valjevo, in the hands of the Dahije (renegade Janissaries) in March 1804. Valjevo was the centre of the Valjevo nahiya in the west of the main rebel territory of à  umadija. It was in the hands of PoreÃÂ-Alija, a notorious Janissary. After failed negotiations, the rebels besieged and assaulted the city, forcing the "Turks" to leave it.
After the Slaughter of the Knezes (January 1804), in which Serb notables of the Belgrade Pashalik were murdered, including Mehmed-aga FoÃÂiÃÂ's executions of obor-knez Aleksa Nenadoviàand obor-knez Ilija BirÃÂanin, the Valjevo "Turks", including yerli (natives) and Janissaries, decided that all Turk men of Ub be transferred to Valjevo and their women and children to Uà ¾ice and Soko. Valjevo was to be ready to defend itself from a potential Serb retaliation.
On , Serb notables met at Oraà ¡ac in the Kragujevac nahiya and decided to rise up under the command of KaraÃÂorÃÂe. Aleksa's brother Jakov Nenadoviàhad succeeded as obor-knez of Tamnava, and when hearing that the Kragujevac, Rudnik and most of the Belgrade nahiyas had risen up, he and his nephew, Aleksa's son, the archpriest Matija NenadoviÃÂ, decided to organize rebellion in the Valjevo nahiya. Jakov and Matija took their villagers to the Posovo mountain and Jakov went through the Tamnava and Posavska kneà ¾ina and traded in swines and cattle to fund rebellion. Matija set out to discuss the matter with the villages and was met with great enthusiasm regarding KaraÃÂorÃÂe's uprising in the first village he crossed, that of Kutemica, meeting with Savko Savkoviàand other notables. Matija and Savko called upon MiliàKediÃÂ, the buljubaà ¡a (captain) of executed BirÃÂanin, and the knez of Kolubara, Nikola GrboviÃÂ, the close associate of Aleksa and BirÃÂanin. Grboviàhad survived the slaughter as he was ill and thus escaped capture. On , or the following day, the Serb notables of the Valjevo nahiya gathered at the Brankovina height (BrankovaÃÂki vis) and decided to rise up against the Dahije. Some 700 men were gathered, but they were ill-equipped. Jakov sent Matija to acquire weaponry and ammunition via Austrian officer Mitesser in Semlin (Zemun), a friend of the Nenadoviàfamily. Arsenije Raoniàand à ½ivko Dabià(the son-in-law of Aleksa) immediately went to Ljubiniàwhere they burnt down the inns (hanovi). The majority of the mustered Tamnava rebels were subsequently deterred from rising up through serfs (kmet) that were in contact with PoreÃÂ-Alija, the Dahije commander of Valjevo, but they were persuaded by Matija to gather at Ljubiniàwith the rest of the Valjevo nahiya rebel army. The à  abac Turks called the Sanjak of Zvornik to aid against the rebels.
Jakov took 300 men of Posavina and Tamnava and went to Beljin and fought with the à  abac Turk detachment on , with many wounded on both sides, the rebels losing buljubaà ¡a Isailo LaziÃÂ, and the Turks losing Arpadà ¾iÃÂ-beg. The à  abac Turk detachment went to support Valjevo via Svileuva, in the hands of priest Luka Lazareviàand Ostoja Spuà ¾iàand their 300âÂÂ400 men, and they clashed, with daily shootings from the Gomilica mountain. The Valjevo rebels were informed on KaraÃÂorÃÂe's clash at Drlupa. The town of Rudnik was taken by the rebel army led by KaraÃÂorÃÂe and Milan Obrenoviàon 6 March.
Matija acquired more ammunition from à ½ivkoviàat Zabreà ¾je, while buljubaà ¡a à ½ivan PetroviÃÂ, Arsenije Raoniàand Vasil went to Poà ¡ar and Jasenica to gather more men and to watch PoreÃÂ-Alija, and to hold contact with Nikola GrboviÃÂ, MiliàKediàand Milivoje TadiÃÂ. Matija went to Gomilica where the Valjevo nahiya rebel army and hajduk (brigand) harambaà ¡a leaders (Nediàbrothers, ÃÂorÃÂe from Ostruà ¾je) camped, left half of the ammunition, and then went to Grabovica where he took the command of 200 chosen men to aid his uncle Jakov, but on the way decided to go for Valjevo, on . Matija wanted to live in peace with the Valjevo Turks and thus decided to negotiate.
Matija's detachment approached Valjevo, where they met with six of the town's yerli and demanded that they give up PoreÃÂ-Alija, the Dahije commander in the town, and all of his followers. One of the Valjevo Turk negotiators was a sipahi (Ottoman noble cavalry) and associate of Matija's late father. The rebels ensured that the yerli would be left in peace in the city. Matija told them that the rebels had the support of Dervish Bey, the son of murdered Vizier Hadji Mustafa Pasha, and that his binbaà Âñ (commander) Deli-Ahmet was in their midst. The Valjevo Turks were asked not to support the Dahije, and the rebels said that the Serbs wanted peace as prior to the Dahije and Slaughter of the Knezes. If they didn't comply, the rebels would attack the city, but Matija still told them to take the Turks loyal to the sultan to safety in the çarà Âñ (marketplace) in the upper part while the rebels would attack PoreÃÂ-Alija's konak (mansion). PoreÃÂ-Alija was wanted dead or alive, and if the Valjevo Turks defended him, they would be held accountable.
During the negotiations, Nikola Grboviàappeared with a unit and Jovica Milutinoviàmade ready a barjak (war flag) of scarves. The sipahi asked Matija how he was able to muster such a number of rebels and he answered "you have the haraç defter (Christian tax register), so you should now how many heads there are", and described how all men, young and old, had risen up, and what they now had before them was only what was mustered from Slovac to Brankovina, while other armies were under Milovan and Kediàat Brankovina, at Beli Brod, at Paleà ¾ watching Belgrade, at Gomilica and Svileuva watching the à  abac and Zvornik troops, the latter encircled by Jakov. The Valjevo Turks were now given five days of contemplation, either give up PoreÃÂ-Alija or be attacked.
In the following days, Grboviàappeared with his unit outside the city and then returned to the camp. Jovica flew war flags in the surroundings as to induce fear. Matija and buljubaà ¡a à ½ivan led the discussions on attack plans, with Grboviàcommenting that while the siege camp awaited events in Svileuva where 200 men were stationed, it was better to begin the operation; Grboviàwanted to set fire to hay and chardaks to scare Valjevo. Matija approved, and on the night of 10 or , GrboviÃÂ's men immediately set it in motion and set fire to hay and chardaks towards à ½uber near Valjevo, half an hour from Valjevo, and this could be seen clearly in the region. He wanted to show the Valjevo Turks that the rebels were serious, "let the dog's faith know that we do not joke, and really want to incinerate". Kediàat the Vrana height and Tadiàat BrÃÂani, on the other side of Valjevo, saw the smoke and believed that an assault had begun, thus proceeded to enter the city and put houses on fire. Kediàentered the Serb mahala (neighbourhood) while Tadiàentered the Vidrak mahala, inhabited by Turks, and set houses on fire and shootouts began. Matija, camping at Grabovica with 500 men, was informed in the night by a sentry that Valjevo was in flames and saw it for himself, then hurried for Valjevo. PoreÃÂ-Alija ordered for the nearby houses, both Turk and Serb, to be put on fire as to gain distance with muskets on incoming rebels for better defense. This made it look like the city was on fire from a far. All yerli and Janissaries gathered at PoreÃÂ-Alija's fortification and were set up by the walls. Matija's unit with only 100 muskets descended into the KliÃÂevac field where a skirmish left two rebels from Vrhovina dead. The next day, , the rebels attacked the city and the fight took a whole day, with many casualties on both sides. Matija's unit put some houses on fire and forced Turks into PoreÃÂ-Alija's courtyard. The rebels retreated cross the Kolubara to continue the attack the next day, and discussed further plans. Grboviàstressed that Valjevo couldn't be defended without a cannon, and that they should hold it in siege until hunger and other anguish strikes, and that the rebels had insufficient ammunition which Matija should acquire more of while Grbovià"blackmail them, as they did to my Aleksa and BirÃÂanin". That night, Matija and his men saw the red sky over Rudnik, burnt down by KaraÃÂorÃÂe's troops, while they too, saw the flames of Valjevo. At the same time, Jakov Nenadoviàdestroyed a unit at Svileuva, leaving 270 dead and many wounded. In the night, the Turks decided to give up the city and fled to Uà ¾ice or Soko. Matija, while at Zabreà ¾je, was informed on on Jakov's victory at Svileuva, and Grboviàinformed that the Valjevo Turks had left the city for Soko in the night prior to .
Matija met with Mitesser who congratulated the rebels on their three important victories at Valjevo, Svileuva and Rudnik. Matija proceeded to send letters to KaraÃÂorÃÂe and Habsburg Serb metropolitan Stefan StratimiroviÃÂ. Jakov NenadoviÃÂ, together with priest Luka Lazareviàand Ostoja Spuà ¾iÃÂ, watched à  abac and blocked the roads from Valjevo, setting up ambuscades on the roads from Soko, Uà ¾ice and Bosnia, then proceeded to approach Ub and Paleà ¾. Within ten days, Jakov conquered Ub and Paleà ¾ and then set out for à  abac. Jakov informed KaraÃÂorÃÂe that the BelgradeâÂÂPaleà ¾ roads were blocked off and ready for ambush.